@fincity/kirun-js 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,6 @@ import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/F
3
3
 
4
4
  test('Delete Test 1', async () => {
5
5
  let delet: Delete = new Delete();
6
-
7
6
  let source: any[] = [12, 14, 15, 9];
8
7
 
9
8
  let secondSource: any[] = [14, 15];
@@ -13,8 +12,8 @@ test('Delete Test 1', async () => {
13
12
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters()
14
13
  .setArguments(
15
14
  new Map([
16
- [Delete.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName(), source],
17
- [Delete.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName(), secondSource],
15
+ [Delete.PARAMETER_ARRAY_SOURCE.getParameterName(), source],
16
+ [Delete.PARAMETER_ANY_VAR_ARGS.getParameterName(), secondSource],
18
17
  ]),
19
18
  )
20
19
  .setSteps(new Map([]))
@@ -27,7 +26,6 @@ test('Delete Test 1', async () => {
27
26
 
28
27
  test('Delete Test 2', async () => {
29
28
  let delet: Delete = new Delete();
30
-
31
29
  let source: any[] = ['nocode', 'platform', 14];
32
30
 
33
31
  let secondSource: any[] = ['platform'];
@@ -37,8 +35,8 @@ test('Delete Test 2', async () => {
37
35
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters()
38
36
  .setArguments(
39
37
  new Map([
40
- [Delete.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName(), source],
41
- [Delete.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName(), secondSource],
38
+ [Delete.PARAMETER_ARRAY_SOURCE.getParameterName(), source],
39
+ [Delete.PARAMETER_ANY_VAR_ARGS.getParameterName(), secondSource],
42
40
  ]),
43
41
  )
44
42
  .setSteps(new Map([]))
@@ -49,9 +47,9 @@ test('Delete Test 2', async () => {
49
47
  expect(source).toStrictEqual(temp);
50
48
  });
51
49
 
50
+
52
51
  test('Delete Test 3', async () => {
53
52
  let delet: Delete = new Delete();
54
-
55
53
  let source = undefined;
56
54
 
57
55
  let secondSource: any[] = ['platform'];
@@ -59,8 +57,8 @@ test('Delete Test 3', async () => {
59
57
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters()
60
58
  .setArguments(
61
59
  new Map([
62
- [Delete.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName(), source],
63
- [Delete.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName(), secondSource],
60
+ [Delete.PARAMETER_ARRAY_SOURCE.getParameterName(), source],
61
+ [Delete.PARAMETER_ANY_VAR_ARGS.getParameterName(), secondSource],
64
62
  ]),
65
63
  )
66
64
  .setSteps(new Map([]))
@@ -71,7 +69,6 @@ test('Delete Test 3', async () => {
71
69
 
72
70
  test('Delete Test 3', async () => {
73
71
  let delet: Delete = new Delete();
74
-
75
72
  let source: any[] = ['platform'];
76
73
 
77
74
  let secondSource = undefined;
@@ -79,8 +76,8 @@ test('Delete Test 3', async () => {
79
76
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters()
80
77
  .setArguments(
81
78
  new Map([
82
- [Delete.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName(), source],
83
- [Delete.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName(), secondSource],
79
+ [Delete.PARAMETER_ARRAY_SOURCE.getParameterName(), source],
80
+ [Delete.PARAMETER_ANY_VAR_ARGS.getParameterName(), secondSource],
84
81
  ]),
85
82
  )
86
83
  .setSteps(new Map([]))
@@ -91,7 +88,6 @@ test('Delete Test 3', async () => {
91
88
 
92
89
  test('Delete Test 4', async () => {
93
90
  let delet: Delete = new Delete();
94
-
95
91
  let source: any[] = ['platform'];
96
92
 
97
93
  let secondSource: any[] = [];
@@ -99,8 +95,8 @@ test('Delete Test 4', async () => {
99
95
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters()
100
96
  .setArguments(
101
97
  new Map([
102
- [Delete.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName(), source],
103
- [Delete.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName(), secondSource],
98
+ [Delete.PARAMETER_ARRAY_SOURCE.getParameterName(), source],
99
+ [Delete.PARAMETER_ANY_VAR_ARGS.getParameterName(), secondSource],
104
100
  ]),
105
101
  )
106
102
  .setSteps(new Map([]))
@@ -108,3 +104,41 @@ test('Delete Test 4', async () => {
108
104
 
109
105
  await expect(delet.execute(fep)).rejects.toThrow();
110
106
  });
107
+
108
+ test('Delete Test 5', () => {
109
+ var arr1: any[] = ['nocode', 'platform', 14];
110
+ var arr2: any[] = ['nocode', 'platiform', 14];
111
+ var obj: object = {
112
+ arr: arr1,
113
+ sri: 'krishna',
114
+ name: 'surendhar',
115
+ };
116
+
117
+ var arr: any[] = [];
118
+ arr.push(arr1);
119
+ arr.push(arr2);
120
+ arr.push(obj);
121
+ arr.push(arr2);
122
+ arr.push(obj);
123
+
124
+ var delArr: any[] = [];
125
+ delArr.push(obj);
126
+ delArr.push('2');
127
+ delArr.push([]);
128
+
129
+ var res: any[] = [arr1, arr2, arr2];
130
+
131
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters()
132
+ .setArguments(
133
+ new Map([
134
+ [Delete.PARAMETER_ARRAY_SOURCE.getParameterName(), arr],
135
+ [Delete.PARAMETER_ANY_VAR_ARGS.getParameterName(), delArr],
136
+ ]),
137
+ )
138
+ .setSteps(new Map([]))
139
+ .setContext(new Map([]));
140
+
141
+ delet.execute(fep);
142
+
143
+ expect(arr).toStrictEqual(res);
144
+ });
@@ -0,0 +1,46 @@
1
+ import { RandomInt } from '../../../../../src/engine/function/system/math/RandomInt';
2
+ import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
3
+
4
+ const rand = new RandomInt();
5
+
6
+ test(' rand int 1', () => {
7
+ let min = 100,
8
+ max = 1000123;
9
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
10
+ new Map([
11
+ ['minValue', min],
12
+ ['maxValue', max],
13
+ ]),
14
+ );
15
+ let num: number = rand.execute(fep).allResults()[0].getResult().get('value');
16
+
17
+ expect(num).toBeLessThanOrEqual(max);
18
+ expect(num).toBeGreaterThanOrEqual(min);
19
+ });
20
+
21
+ test(' rand int 2', () => {
22
+ let min = 100;
23
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
24
+ new Map([['minValue', min]]),
25
+ );
26
+ let num: number = rand.execute(fep).allResults()[0].getResult().get('value');
27
+
28
+ expect(num).toBeLessThanOrEqual(2147483647);
29
+ expect(num).toBeGreaterThanOrEqual(min);
30
+ });
31
+
32
+ test(' rand int 3', () => {
33
+ let min = 100,
34
+ max = 101;
35
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
36
+ new Map([
37
+ ['minValue', min],
38
+ ['maxValue', max],
39
+ ]),
40
+ );
41
+ let num: number = rand.execute(fep).allResults()[0].getResult().get('value');
42
+
43
+ console.log(num);
44
+ expect(num).toBeLessThanOrEqual(max);
45
+ expect(num).toBeGreaterThanOrEqual(min);
46
+ });