@fincity/kirun-js 1.6.17 → 1.8.0
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.
- package/__tests__/engine/function/system/array/AddFirstTest.ts +28 -19
- package/__tests__/engine/function/system/array/ArrayToArrayOfObjectsTest.ts +0 -2
- package/__tests__/engine/function/system/array/ArrayToObjectTest.ts +180 -0
- package/__tests__/engine/function/system/array/BinarySearchTest.ts +5 -20
- package/__tests__/engine/function/system/array/{AddTest.ts → ConcatenateTest.ts} +22 -24
- package/__tests__/engine/function/system/array/CopyTest.ts +1 -1
- package/__tests__/engine/function/system/array/DeleteFirstTest.ts +7 -9
- package/__tests__/engine/function/system/array/DeleteFromTest.ts +4 -12
- package/__tests__/engine/function/system/array/DeleteLastTest.ts +7 -9
- package/__tests__/engine/function/system/array/DeleteTest.ts +7 -9
- package/__tests__/engine/function/system/array/DisjointTest.ts +3 -3
- package/__tests__/engine/function/system/array/FillTest.ts +6 -6
- package/__tests__/engine/function/system/array/FrequencyTest.ts +2 -2
- package/__tests__/engine/function/system/array/IndexOfArrayTest.ts +6 -24
- package/__tests__/engine/function/system/array/IndexOfTest.ts +5 -17
- package/__tests__/engine/function/system/array/InsertTest.ts +5 -15
- package/__tests__/engine/function/system/array/LastIndexOfArrayTest.ts +3 -3
- package/__tests__/engine/function/system/array/LastIndexOfTest.ts +4 -18
- package/__tests__/engine/function/system/array/MaxTest.ts +6 -8
- package/__tests__/engine/function/system/array/MinTest.ts +8 -8
- package/__tests__/engine/function/system/array/MisMatchTest.ts +3 -12
- package/__tests__/engine/function/system/array/RemoveDuplicatesTest.ts +74 -0
- package/__tests__/engine/function/system/array/ReverseTest.ts +4 -8
- package/__tests__/engine/function/system/array/RotateTest.ts +9 -9
- package/__tests__/engine/function/system/array/SortTest.ts +5 -5
- package/__tests__/engine/function/system/array/SubArrayTest.ts +4 -13
- package/__tests__/engine/function/system/loop/BreakLoopTest.ts +173 -0
- package/__tests__/engine/function/system/loop/CountLoopTest.ts +1 -1
- package/__tests__/engine/function/system/loop/RangeLoopTest.ts +145 -0
- package/__tests__/engine/function/system/string/SplitTest.ts +2 -2
- package/__tests__/engine/json/schema/validator/ArraySchemaAdapterTypeTest.ts +0 -1
- package/__tests__/engine/json/schema/validator/NotValidatorTest.ts +47 -0
- package/__tests__/engine/runtime/KIRuntimeNoValuesTest.ts +0 -1
- package/__tests__/engine/runtime/expression/tokenextractor/ObjectValueSetterExtractorTest.ts +51 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +41 -30
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/engine/function/system/array/AbstractArrayFunction.ts +5 -0
- package/src/engine/function/system/array/AddFirst.ts +8 -7
- package/src/engine/function/system/array/ArrayFunctionRepository.ts +8 -2
- package/src/engine/function/system/array/ArrayToObject.ts +77 -0
- package/src/engine/function/system/array/BinarySearch.ts +1 -1
- package/src/engine/function/system/array/{Add.ts → Concatenate.ts} +8 -6
- package/src/engine/function/system/array/Copy.ts +2 -2
- package/src/engine/function/system/array/Delete.ts +11 -7
- package/src/engine/function/system/array/DeleteFirst.ts +5 -2
- package/src/engine/function/system/array/DeleteFrom.ts +5 -2
- package/src/engine/function/system/array/DeleteLast.ts +5 -2
- package/src/engine/function/system/array/Disjoint.ts +1 -5
- package/src/engine/function/system/array/Fill.ts +6 -2
- package/src/engine/function/system/array/Frequency.ts +2 -5
- package/src/engine/function/system/array/IndexOf.ts +2 -2
- package/src/engine/function/system/array/IndexOfArray.ts +2 -2
- package/src/engine/function/system/array/Insert.ts +9 -3
- package/src/engine/function/system/array/InsertLast.ts +31 -0
- package/src/engine/function/system/array/LastIndexOf.ts +2 -7
- package/src/engine/function/system/array/LastIndexOfArray.ts +2 -6
- package/src/engine/function/system/array/Max.ts +1 -3
- package/src/engine/function/system/array/Min.ts +1 -3
- package/src/engine/function/system/array/MisMatch.ts +1 -1
- package/src/engine/function/system/array/RemoveDuplicates.ts +64 -0
- package/src/engine/function/system/array/Reverse.ts +6 -2
- package/src/engine/function/system/array/Rotate.ts +10 -3
- package/src/engine/function/system/array/Shuffle.ts +9 -3
- package/src/engine/function/system/array/Sort.ts +4 -3
- package/src/engine/function/system/array/SubArray.ts +1 -1
- package/src/engine/function/system/loop/Break.ts +31 -0
- package/src/engine/function/system/loop/CountLoop.ts +8 -2
- package/src/engine/function/system/loop/ForEachLoop.ts +70 -0
- package/src/engine/function/system/loop/RangeLoop.ts +7 -1
- package/src/engine/function/system/object/ObjectFunctionRepository.ts +2 -0
- package/src/engine/function/system/object/ObjectPutValue.ts +61 -0
- package/src/engine/json/schema/validator/SchemaValidator.ts +3 -2
- package/src/engine/repository/KIRunFunctionRepository.ts +5 -1
- package/src/engine/runtime/FunctionExecutionParameters.ts +10 -1
- package/src/engine/runtime/KIRuntime.ts +2 -1
- package/src/engine/runtime/expression/operators/binary/ArithmeticAdditionOperator.ts +3 -2
- package/src/engine/runtime/expression/tokenextractor/ObjectValueSetterExtractor.ts +172 -0
- package/src/engine/runtime/expression/tokenextractor/TokenValueExtractor.ts +1 -1
- package/src/index.ts +1 -0
|
@@ -14,7 +14,7 @@ test('Fill Test', async () => {
|
|
|
14
14
|
|
|
15
15
|
fep.setArguments(MapUtil.of('source', array as any, 'element', 3));
|
|
16
16
|
|
|
17
|
-
await fill.execute(fep);
|
|
17
|
+
array = (await fill.execute(fep)).allResults()[0].getResult().get('result');
|
|
18
18
|
expect(array).toStrictEqual([3, 3]);
|
|
19
19
|
|
|
20
20
|
fep.setArguments(MapUtil.of('source', array as any, 'element', 5, 'srcFrom', 2, 'length', 5))
|
|
@@ -22,17 +22,17 @@ test('Fill Test', async () => {
|
|
|
22
22
|
.setSteps(MapUtil.of());
|
|
23
23
|
|
|
24
24
|
let finArray = [3, 3, 5, 5, 5, 5, 5];
|
|
25
|
-
await fill.execute(fep);
|
|
26
25
|
|
|
27
|
-
|
|
26
|
+
array = (await fill.execute(fep)).allResults()[0].getResult().get('result');
|
|
27
|
+
expect(array).toMatchObject(finArray);
|
|
28
28
|
|
|
29
29
|
fep.setArguments(MapUtil.of('source', array as any, 'element', 25, 'srcFrom', 5));
|
|
30
30
|
|
|
31
31
|
finArray = [3, 3, 5, 5, 5, 25, 25];
|
|
32
32
|
|
|
33
|
-
await fill.execute(fep)
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
expect((await fill.execute(fep)).allResults()[0].getResult().get('result')).toMatchObject(
|
|
34
|
+
finArray,
|
|
35
|
+
);
|
|
36
36
|
|
|
37
37
|
fep.setArguments(MapUtil.of('source', array as any, 'element', 20, 'srcFrom', -1));
|
|
38
38
|
|
|
@@ -36,7 +36,7 @@ test('freq test 1', async () => {
|
|
|
36
36
|
);
|
|
37
37
|
|
|
38
38
|
expect(
|
|
39
|
-
(await freq.execute(fep)).allResults()[0].getResult().get(Frequency.
|
|
39
|
+
(await freq.execute(fep)).allResults()[0].getResult().get(Frequency.EVENT_RESULT_NAME),
|
|
40
40
|
).toBe(2);
|
|
41
41
|
});
|
|
42
42
|
|
|
@@ -102,6 +102,6 @@ test('freq test 3', async () => {
|
|
|
102
102
|
);
|
|
103
103
|
|
|
104
104
|
expect(
|
|
105
|
-
(await freq.execute(fep)).allResults()[0].getResult().get(Frequency.
|
|
105
|
+
(await freq.execute(fep)).allResults()[0].getResult().get(Frequency.EVENT_RESULT_NAME),
|
|
106
106
|
).toBe(0);
|
|
107
107
|
});
|
|
@@ -33,10 +33,7 @@ test('index of array 1', async () => {
|
|
|
33
33
|
);
|
|
34
34
|
|
|
35
35
|
expect(
|
|
36
|
-
(await ioa.execute(fep))
|
|
37
|
-
.allResults()[0]
|
|
38
|
-
.getResult()
|
|
39
|
-
.get(IndexOfArray.EVENT_RESULT_INTEGER.getName()),
|
|
36
|
+
(await ioa.execute(fep)).allResults()[0].getResult().get(IndexOfArray.EVENT_RESULT_NAME),
|
|
40
37
|
).toBe(1);
|
|
41
38
|
});
|
|
42
39
|
|
|
@@ -70,10 +67,7 @@ test('Index of array 2', async () => {
|
|
|
70
67
|
);
|
|
71
68
|
|
|
72
69
|
expect(
|
|
73
|
-
(await ioa.execute(fep))
|
|
74
|
-
.allResults()[0]
|
|
75
|
-
.getResult()
|
|
76
|
-
.get(IndexOfArray.EVENT_RESULT_INTEGER.getName()),
|
|
70
|
+
(await ioa.execute(fep)).allResults()[0].getResult().get(IndexOfArray.EVENT_RESULT_NAME),
|
|
77
71
|
).toBe(5);
|
|
78
72
|
});
|
|
79
73
|
|
|
@@ -169,10 +163,7 @@ test('index of array 3', async () => {
|
|
|
169
163
|
);
|
|
170
164
|
|
|
171
165
|
expect(
|
|
172
|
-
(await ioa.execute(fep))
|
|
173
|
-
.allResults()[0]
|
|
174
|
-
.getResult()
|
|
175
|
-
.get(IndexOfArray.EVENT_RESULT_INTEGER.getName()),
|
|
166
|
+
(await ioa.execute(fep)).allResults()[0].getResult().get(IndexOfArray.EVENT_RESULT_NAME),
|
|
176
167
|
).toBe(7);
|
|
177
168
|
});
|
|
178
169
|
|
|
@@ -205,10 +196,7 @@ test('index of array test 4', async () => {
|
|
|
205
196
|
);
|
|
206
197
|
|
|
207
198
|
expect(
|
|
208
|
-
(await ioa.execute(fep))
|
|
209
|
-
.allResults()[0]
|
|
210
|
-
.getResult()
|
|
211
|
-
.get(IndexOfArray.EVENT_RESULT_INTEGER.getName()),
|
|
199
|
+
(await ioa.execute(fep)).allResults()[0].getResult().get(IndexOfArray.EVENT_RESULT_NAME),
|
|
212
200
|
).toBe(-1);
|
|
213
201
|
});
|
|
214
202
|
|
|
@@ -238,10 +226,7 @@ test('index of array 5', async () => {
|
|
|
238
226
|
]),
|
|
239
227
|
);
|
|
240
228
|
expect(
|
|
241
|
-
(await ioa.execute(fep))
|
|
242
|
-
.allResults()[0]
|
|
243
|
-
.getResult()
|
|
244
|
-
.get(IndexOfArray.EVENT_RESULT_INTEGER.getName()),
|
|
229
|
+
(await ioa.execute(fep)).allResults()[0].getResult().get(IndexOfArray.EVENT_RESULT_NAME),
|
|
245
230
|
).toBe(6);
|
|
246
231
|
});
|
|
247
232
|
|
|
@@ -355,9 +340,6 @@ test('index of array 3', async () => {
|
|
|
355
340
|
);
|
|
356
341
|
|
|
357
342
|
expect(
|
|
358
|
-
(await ioa.execute(fep))
|
|
359
|
-
.allResults()[0]
|
|
360
|
-
.getResult()
|
|
361
|
-
.get(IndexOfArray.EVENT_RESULT_INTEGER.getName()),
|
|
343
|
+
(await ioa.execute(fep)).allResults()[0].getResult().get(IndexOfArray.EVENT_RESULT_NAME),
|
|
362
344
|
).toBe(-1);
|
|
363
345
|
});
|
|
@@ -37,10 +37,7 @@ test('Index of Test 1', async () => {
|
|
|
37
37
|
]),
|
|
38
38
|
);
|
|
39
39
|
expect(
|
|
40
|
-
(await ind.execute(fep))
|
|
41
|
-
.allResults()[0]
|
|
42
|
-
.getResult()
|
|
43
|
-
.get(IndexOf.EVENT_RESULT_INTEGER.getName()),
|
|
40
|
+
(await ind.execute(fep)).allResults()[0].getResult().get(IndexOf.EVENT_RESULT_NAME),
|
|
44
41
|
).toBe(12);
|
|
45
42
|
});
|
|
46
43
|
|
|
@@ -89,7 +86,7 @@ test('Index of Test 2', async () => {
|
|
|
89
86
|
]),
|
|
90
87
|
);
|
|
91
88
|
expect(
|
|
92
|
-
(await ind.execute(fep)).allResults()[0].getResult().get(IndexOf.
|
|
89
|
+
(await ind.execute(fep)).allResults()[0].getResult().get(IndexOf.EVENT_RESULT_NAME),
|
|
93
90
|
).toBe(-1);
|
|
94
91
|
});
|
|
95
92
|
|
|
@@ -129,10 +126,7 @@ test('Index of Test 3', async () => {
|
|
|
129
126
|
);
|
|
130
127
|
|
|
131
128
|
expect(
|
|
132
|
-
(await ind.execute(fep))
|
|
133
|
-
.allResults()[0]
|
|
134
|
-
.getResult()
|
|
135
|
-
.get(IndexOf.EVENT_RESULT_INTEGER.getName()),
|
|
129
|
+
(await ind.execute(fep)).allResults()[0].getResult().get(IndexOf.EVENT_RESULT_NAME),
|
|
136
130
|
).toBe(-1);
|
|
137
131
|
});
|
|
138
132
|
|
|
@@ -225,10 +219,7 @@ test('Index of Test 4', async () => {
|
|
|
225
219
|
);
|
|
226
220
|
|
|
227
221
|
expect(
|
|
228
|
-
(await ind.execute(fep))
|
|
229
|
-
.allResults()[0]
|
|
230
|
-
.getResult()
|
|
231
|
-
.get(IndexOf.EVENT_RESULT_INTEGER.getName()),
|
|
222
|
+
(await ind.execute(fep)).allResults()[0].getResult().get(IndexOf.EVENT_RESULT_NAME),
|
|
232
223
|
).toBe(2);
|
|
233
224
|
});
|
|
234
225
|
|
|
@@ -279,10 +270,7 @@ test('indexof test 5', async () => {
|
|
|
279
270
|
);
|
|
280
271
|
|
|
281
272
|
expect(
|
|
282
|
-
(await ind.execute(fep))
|
|
283
|
-
.allResults()[0]
|
|
284
|
-
.getResult()
|
|
285
|
-
.get(IndexOf.EVENT_RESULT_INTEGER.getName()),
|
|
273
|
+
(await ind.execute(fep)).allResults()[0].getResult().get(IndexOf.EVENT_RESULT_NAME),
|
|
286
274
|
).toBe(5);
|
|
287
275
|
|
|
288
276
|
fep.setArguments(
|
|
@@ -58,9 +58,7 @@ test('Insert of Test 1', async () => {
|
|
|
58
58
|
res.push('Driven');
|
|
59
59
|
res.push('developement');
|
|
60
60
|
|
|
61
|
-
await ins.execute(fep);
|
|
62
|
-
|
|
63
|
-
expect(array).toStrictEqual(res);
|
|
61
|
+
expect((await ins.execute(fep)).allResults()[0].getResult().get('result')).toStrictEqual(res);
|
|
64
62
|
});
|
|
65
63
|
|
|
66
64
|
test('Insert of Test 2', async () => {
|
|
@@ -102,9 +100,7 @@ test('Insert of Test 2', async () => {
|
|
|
102
100
|
res.push(6);
|
|
103
101
|
res.push(7);
|
|
104
102
|
res.push(8);
|
|
105
|
-
await ins.execute(fep);
|
|
106
|
-
|
|
107
|
-
expect(arr).toStrictEqual(res);
|
|
103
|
+
expect((await ins.execute(fep)).allResults()[0].getResult().get('result')).toStrictEqual(res);
|
|
108
104
|
});
|
|
109
105
|
|
|
110
106
|
test('Insert of Test 3', async () => {
|
|
@@ -146,9 +142,7 @@ test('Insert of Test 3', async () => {
|
|
|
146
142
|
res.push(6);
|
|
147
143
|
res.push(7);
|
|
148
144
|
res.push(8);
|
|
149
|
-
await ins.execute(fep);
|
|
150
|
-
|
|
151
|
-
expect(arr).toStrictEqual(res);
|
|
145
|
+
expect((await ins.execute(fep)).allResults()[0].getResult().get('result')).toStrictEqual(res);
|
|
152
146
|
});
|
|
153
147
|
|
|
154
148
|
test('Insert of Test 4', async () => {
|
|
@@ -191,9 +185,7 @@ test('Insert of Test 4', async () => {
|
|
|
191
185
|
res.push(8);
|
|
192
186
|
res.push(['this is an array']);
|
|
193
187
|
|
|
194
|
-
await ins.execute(fep);
|
|
195
|
-
|
|
196
|
-
expect(arr).toStrictEqual(res);
|
|
188
|
+
expect((await ins.execute(fep)).allResults()[0].getResult().get('result')).toStrictEqual(res);
|
|
197
189
|
});
|
|
198
190
|
|
|
199
191
|
test('Insert of Test 5', async () => {
|
|
@@ -218,9 +210,7 @@ test('Insert of Test 5', async () => {
|
|
|
218
210
|
|
|
219
211
|
res.push(['this is an array']);
|
|
220
212
|
|
|
221
|
-
await ins.execute(fep);
|
|
222
|
-
|
|
223
|
-
expect(arr).toStrictEqual(res);
|
|
213
|
+
expect((await ins.execute(fep)).allResults()[0].getResult().get('result')).toStrictEqual(res);
|
|
224
214
|
});
|
|
225
215
|
|
|
226
216
|
test('Insert of Test 6', async () => {
|
|
@@ -39,7 +39,7 @@ test('Last Index of array Test 1', async () => {
|
|
|
39
39
|
(await larr.execute(fep))
|
|
40
40
|
.allResults()[0]
|
|
41
41
|
.getResult()
|
|
42
|
-
.get(LastIndexOfArray.
|
|
42
|
+
.get(LastIndexOfArray.EVENT_RESULT_NAME),
|
|
43
43
|
).toBe(9);
|
|
44
44
|
});
|
|
45
45
|
|
|
@@ -76,7 +76,7 @@ test('last index of array test 2', async () => {
|
|
|
76
76
|
(await larr.execute(fep))
|
|
77
77
|
.allResults()[0]
|
|
78
78
|
.getResult()
|
|
79
|
-
.get(LastIndexOfArray.
|
|
79
|
+
.get(LastIndexOfArray.EVENT_RESULT_NAME),
|
|
80
80
|
).toBe(-1);
|
|
81
81
|
});
|
|
82
82
|
|
|
@@ -221,6 +221,6 @@ test('last index of array test 4', async () => {
|
|
|
221
221
|
(await larr.execute(fep))
|
|
222
222
|
.allResults()[0]
|
|
223
223
|
.getResult()
|
|
224
|
-
.get(LastIndexOfArray.
|
|
224
|
+
.get(LastIndexOfArray.EVENT_RESULT_NAME),
|
|
225
225
|
).toBe(7);
|
|
226
226
|
});
|
|
@@ -37,10 +37,7 @@ test('Last Index of Test 1', async () => {
|
|
|
37
37
|
]),
|
|
38
38
|
);
|
|
39
39
|
expect(
|
|
40
|
-
(await lind.execute(fep))
|
|
41
|
-
.allResults()[0]
|
|
42
|
-
.getResult()
|
|
43
|
-
.get(LastIndexOf.EVENT_RESULT_INTEGER.getName()),
|
|
40
|
+
(await lind.execute(fep)).allResults()[0].getResult().get(LastIndexOf.EVENT_RESULT_NAME),
|
|
44
41
|
).toBe(13);
|
|
45
42
|
});
|
|
46
43
|
|
|
@@ -153,10 +150,7 @@ test('Last Index of Test 4', async () => {
|
|
|
153
150
|
]),
|
|
154
151
|
);
|
|
155
152
|
expect(
|
|
156
|
-
(await lind.execute(fep))
|
|
157
|
-
.allResults()[0]
|
|
158
|
-
.getResult()
|
|
159
|
-
.get(LastIndexOf.EVENT_RESULT_INTEGER.getName()),
|
|
153
|
+
(await lind.execute(fep)).allResults()[0].getResult().get(LastIndexOf.EVENT_RESULT_NAME),
|
|
160
154
|
).toBe(15);
|
|
161
155
|
|
|
162
156
|
fep.setArguments(
|
|
@@ -167,10 +161,7 @@ test('Last Index of Test 4', async () => {
|
|
|
167
161
|
]),
|
|
168
162
|
);
|
|
169
163
|
expect(
|
|
170
|
-
(await lind.execute(fep))
|
|
171
|
-
.allResults()[0]
|
|
172
|
-
.getResult()
|
|
173
|
-
.get(LastIndexOf.EVENT_RESULT_INTEGER.getName()),
|
|
164
|
+
(await lind.execute(fep)).allResults()[0].getResult().get(LastIndexOf.EVENT_RESULT_NAME),
|
|
174
165
|
).toBe(-1);
|
|
175
166
|
});
|
|
176
167
|
|
|
@@ -263,10 +254,5 @@ test('Last Index of Test 6', async () => {
|
|
|
263
254
|
[LastIndexOf.PARAMETER_INT_FIND_FROM.getParameterName(), 1],
|
|
264
255
|
]),
|
|
265
256
|
);
|
|
266
|
-
expect(
|
|
267
|
-
(await lind.execute(fep))
|
|
268
|
-
.allResults()[0]
|
|
269
|
-
.getResult()
|
|
270
|
-
.get(LastIndexOf.EVENT_RESULT_EMPTY.getName()),
|
|
271
|
-
).toBe(4);
|
|
257
|
+
expect((await lind.execute(fep)).allResults()[0].getResult().get('result')).toBe(4);
|
|
272
258
|
});
|
|
@@ -14,9 +14,7 @@ test('max test 1 ', async () => {
|
|
|
14
14
|
new KIRunSchemaRepository(),
|
|
15
15
|
).setArguments(new Map([[Max.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName(), arr]]));
|
|
16
16
|
|
|
17
|
-
expect(
|
|
18
|
-
(await max.execute(fep)).allResults()[0].getResult().get(Max.EVENT_RESULT_ANY.getName()),
|
|
19
|
-
).toBe(12);
|
|
17
|
+
expect((await max.execute(fep)).allResults()[0].getResult().get('result')).toBe(12);
|
|
20
18
|
});
|
|
21
19
|
|
|
22
20
|
test('max test 2 ', async () => {
|
|
@@ -42,7 +40,7 @@ test('max test 3', async () => {
|
|
|
42
40
|
new KIRunFunctionRepository(),
|
|
43
41
|
new KIRunSchemaRepository(),
|
|
44
42
|
).setArguments(new Map([[Max.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName(), arr]]));
|
|
45
|
-
expect((await max.execute(fep)).allResults()[0].getResult().get('
|
|
43
|
+
expect((await max.execute(fep)).allResults()[0].getResult().get('result')).toBe(98);
|
|
46
44
|
});
|
|
47
45
|
|
|
48
46
|
test('Max test 4', async () => {
|
|
@@ -54,7 +52,7 @@ test('Max test 4', async () => {
|
|
|
54
52
|
new KIRunFunctionRepository(),
|
|
55
53
|
new KIRunSchemaRepository(),
|
|
56
54
|
).setArguments(new Map([[Max.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName(), arr]]));
|
|
57
|
-
expect((await max.execute(fep)).allResults()[0].getResult().get('
|
|
55
|
+
expect((await max.execute(fep)).allResults()[0].getResult().get('result')).toBe('platform');
|
|
58
56
|
});
|
|
59
57
|
|
|
60
58
|
test('Max test 6', async () => {
|
|
@@ -79,7 +77,7 @@ test('Max test 5', async () => {
|
|
|
79
77
|
new KIRunFunctionRepository(),
|
|
80
78
|
new KIRunSchemaRepository(),
|
|
81
79
|
).setArguments(new Map([[Max.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName(), arr]]));
|
|
82
|
-
expect((await max.execute(fep)).allResults()[0].getResult().get('
|
|
80
|
+
expect((await max.execute(fep)).allResults()[0].getResult().get('result')).toBe('platform');
|
|
83
81
|
});
|
|
84
82
|
|
|
85
83
|
test('Max test 7', async () => {
|
|
@@ -93,7 +91,7 @@ test('Max test 7', async () => {
|
|
|
93
91
|
new KIRunSchemaRepository(),
|
|
94
92
|
).setArguments(new Map([[Max.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName(), arr1]]));
|
|
95
93
|
|
|
96
|
-
expect((await max.execute(fep)).allResults()[0].getResult().get('
|
|
94
|
+
expect((await max.execute(fep)).allResults()[0].getResult().get('result')).toBe('s');
|
|
97
95
|
});
|
|
98
96
|
|
|
99
97
|
test('Max test 8', async () => {
|
|
@@ -103,5 +101,5 @@ test('Max test 8', async () => {
|
|
|
103
101
|
new KIRunSchemaRepository(),
|
|
104
102
|
).setArguments(new Map([[Max.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName(), arr]]));
|
|
105
103
|
|
|
106
|
-
expect((await max.execute(fep)).allResults()[0].getResult().get('
|
|
104
|
+
expect((await max.execute(fep)).allResults()[0].getResult().get('result')).toBe('surendhar');
|
|
107
105
|
});
|
|
@@ -14,9 +14,9 @@ test('min test 1 ', async () => {
|
|
|
14
14
|
new KIRunSchemaRepository(),
|
|
15
15
|
).setArguments(new Map([[Min.PARAMETER_ARRAY_SOURCE.getParameterName(), arr]]));
|
|
16
16
|
|
|
17
|
-
expect(
|
|
18
|
-
|
|
19
|
-
)
|
|
17
|
+
expect((await min.execute(fep)).allResults()[0].getResult().get(Min.EVENT_RESULT_NAME)).toBe(
|
|
18
|
+
12,
|
|
19
|
+
);
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
test('min test 2 ', async () => {
|
|
@@ -42,7 +42,7 @@ test('min test 3', async () => {
|
|
|
42
42
|
new KIRunFunctionRepository(),
|
|
43
43
|
new KIRunSchemaRepository(),
|
|
44
44
|
).setArguments(new Map([[Min.PARAMETER_ARRAY_SOURCE.getParameterName(), arr]]));
|
|
45
|
-
expect((await min.execute(fep)).allResults()[0].getResult().get('
|
|
45
|
+
expect((await min.execute(fep)).allResults()[0].getResult().get('result')).toBe(1);
|
|
46
46
|
});
|
|
47
47
|
|
|
48
48
|
test('min test 4', async () => {
|
|
@@ -55,7 +55,7 @@ test('min test 4', async () => {
|
|
|
55
55
|
new KIRunFunctionRepository(),
|
|
56
56
|
new KIRunSchemaRepository(),
|
|
57
57
|
).setArguments(new Map([[Min.PARAMETER_ARRAY_SOURCE.getParameterName(), arr]]));
|
|
58
|
-
expect((await min.execute(fep)).allResults()[0].getResult().get('
|
|
58
|
+
expect((await min.execute(fep)).allResults()[0].getResult().get('result')).toBe('NoCode');
|
|
59
59
|
});
|
|
60
60
|
|
|
61
61
|
test('min test 5', async () => {
|
|
@@ -81,7 +81,7 @@ test('min test 6', async () => {
|
|
|
81
81
|
new KIRunFunctionRepository(),
|
|
82
82
|
new KIRunSchemaRepository(),
|
|
83
83
|
).setArguments(new Map([[Min.PARAMETER_ARRAY_SOURCE.getParameterName(), arr]]));
|
|
84
|
-
expect((await min.execute(fep)).allResults()[0].getResult().get('
|
|
84
|
+
expect((await min.execute(fep)).allResults()[0].getResult().get('result')).toBe(1);
|
|
85
85
|
});
|
|
86
86
|
|
|
87
87
|
test('min test 7', async () => {
|
|
@@ -95,7 +95,7 @@ test('min test 7', async () => {
|
|
|
95
95
|
new KIRunSchemaRepository(),
|
|
96
96
|
).setArguments(new Map([[Min.PARAMETER_ARRAY_SOURCE.getParameterName(), arr1]]));
|
|
97
97
|
|
|
98
|
-
expect((await min.execute(fep)).allResults()[0].getResult().get('
|
|
98
|
+
expect((await min.execute(fep)).allResults()[0].getResult().get('result')).toBe('c');
|
|
99
99
|
});
|
|
100
100
|
|
|
101
101
|
test('min test 8', async () => {
|
|
@@ -104,5 +104,5 @@ test('min test 8', async () => {
|
|
|
104
104
|
new KIRunFunctionRepository(),
|
|
105
105
|
new KIRunSchemaRepository(),
|
|
106
106
|
).setArguments(new Map([[Min.PARAMETER_ARRAY_SOURCE.getParameterName(), arr]]));
|
|
107
|
-
expect((await min.execute(fep)).allResults()[0].getResult().get('
|
|
107
|
+
expect((await min.execute(fep)).allResults()[0].getResult().get('result')).toBe('surendhar');
|
|
108
108
|
});
|
|
@@ -37,10 +37,7 @@ test('mismatch test 1', async () => {
|
|
|
37
37
|
);
|
|
38
38
|
|
|
39
39
|
expect(
|
|
40
|
-
(await mismatch.execute(fep))
|
|
41
|
-
.allResults()[0]
|
|
42
|
-
.getResult()
|
|
43
|
-
.get(MisMatch.EVENT_RESULT_INTEGER.getName()),
|
|
40
|
+
(await mismatch.execute(fep)).allResults()[0].getResult().get(MisMatch.EVENT_RESULT_NAME),
|
|
44
41
|
).toBe(2);
|
|
45
42
|
});
|
|
46
43
|
|
|
@@ -177,10 +174,7 @@ test('Mismatch test 3', async () => {
|
|
|
177
174
|
);
|
|
178
175
|
|
|
179
176
|
expect(
|
|
180
|
-
(await mismatch.execute(fep))
|
|
181
|
-
.allResults()[0]
|
|
182
|
-
.getResult()
|
|
183
|
-
.get(MisMatch.EVENT_RESULT_INTEGER.getName()),
|
|
177
|
+
(await mismatch.execute(fep)).allResults()[0].getResult().get(MisMatch.EVENT_RESULT_NAME),
|
|
184
178
|
).toBe(2);
|
|
185
179
|
});
|
|
186
180
|
|
|
@@ -217,9 +211,6 @@ test('mismatch test 4', async () => {
|
|
|
217
211
|
);
|
|
218
212
|
|
|
219
213
|
expect(
|
|
220
|
-
(await mismatch.execute(fep))
|
|
221
|
-
.allResults()[0]
|
|
222
|
-
.getResult()
|
|
223
|
-
.get(MisMatch.EVENT_RESULT_INTEGER.getName()),
|
|
214
|
+
(await mismatch.execute(fep)).allResults()[0].getResult().get(MisMatch.EVENT_RESULT_NAME),
|
|
224
215
|
).toBe(-1);
|
|
225
216
|
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { AbstractArrayFunction } from '../../../../../src/engine/function/system/array/AbstractArrayFunction';
|
|
2
|
+
import { FunctionOutput } from '../../../../../src/engine/model/FunctionOutput';
|
|
3
|
+
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
4
|
+
|
|
5
|
+
import { MapUtil } from '../../../../../src/engine/util/MapUtil';
|
|
6
|
+
|
|
7
|
+
import { KIRunFunctionRepository, KIRunSchemaRepository } from '../../../../../src';
|
|
8
|
+
import { RemoveDuplicates } from '../../../../../src/engine/function/system/array/RemoveDuplicates';
|
|
9
|
+
|
|
10
|
+
test('RemoveDuplicates Test', async () => {
|
|
11
|
+
let removeDuplicates: RemoveDuplicates = new RemoveDuplicates();
|
|
12
|
+
|
|
13
|
+
let source: any[] = [2, 2, 2, 2, 2];
|
|
14
|
+
|
|
15
|
+
let fep1: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
16
|
+
new KIRunFunctionRepository(),
|
|
17
|
+
new KIRunSchemaRepository(),
|
|
18
|
+
).setArguments(
|
|
19
|
+
MapUtil.of(
|
|
20
|
+
AbstractArrayFunction.PARAMETER_ARRAY_SOURCE.getParameterName(),
|
|
21
|
+
source as any,
|
|
22
|
+
AbstractArrayFunction.PARAMETER_INT_SOURCE_FROM.getParameterName(),
|
|
23
|
+
2,
|
|
24
|
+
AbstractArrayFunction.PARAMETER_INT_LENGTH.getParameterName(),
|
|
25
|
+
4,
|
|
26
|
+
),
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
await expect(removeDuplicates.execute(fep1)).rejects.toThrow();
|
|
30
|
+
|
|
31
|
+
source.push(6);
|
|
32
|
+
|
|
33
|
+
let result: any[] = [2, 2, 2, 6];
|
|
34
|
+
|
|
35
|
+
let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
|
|
36
|
+
new KIRunFunctionRepository(),
|
|
37
|
+
new KIRunSchemaRepository(),
|
|
38
|
+
).setArguments(
|
|
39
|
+
MapUtil.of(
|
|
40
|
+
RemoveDuplicates.PARAMETER_ARRAY_SOURCE.getParameterName(),
|
|
41
|
+
source as any,
|
|
42
|
+
RemoveDuplicates.PARAMETER_INT_SOURCE_FROM.getParameterName(),
|
|
43
|
+
2,
|
|
44
|
+
RemoveDuplicates.PARAMETER_INT_LENGTH.getParameterName(),
|
|
45
|
+
4,
|
|
46
|
+
),
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
let fo: FunctionOutput = await removeDuplicates.execute(fep);
|
|
50
|
+
expect(fo.allResults()[0].getResult().get(RemoveDuplicates.EVENT_RESULT_NAME)).toStrictEqual(
|
|
51
|
+
result,
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
source = new Array();
|
|
55
|
+
source.push({ name: 'Kiran' });
|
|
56
|
+
source.push({ name: 'Kiran' });
|
|
57
|
+
source.push({ name: 'Kiran' });
|
|
58
|
+
source.push({ name: 'Kumar' });
|
|
59
|
+
|
|
60
|
+
result = new Array();
|
|
61
|
+
result.push({ name: 'Kiran' });
|
|
62
|
+
result.push({ name: 'Kumar' });
|
|
63
|
+
|
|
64
|
+
fep = new FunctionExecutionParameters(
|
|
65
|
+
new KIRunFunctionRepository(),
|
|
66
|
+
new KIRunSchemaRepository(),
|
|
67
|
+
).setArguments(MapUtil.of(RemoveDuplicates.PARAMETER_ARRAY_SOURCE.getParameterName(), source));
|
|
68
|
+
|
|
69
|
+
fo = await removeDuplicates.execute(fep);
|
|
70
|
+
|
|
71
|
+
expect(fo.allResults()[0].getResult().get(RemoveDuplicates.EVENT_RESULT_NAME)).toMatchObject(
|
|
72
|
+
result,
|
|
73
|
+
);
|
|
74
|
+
});
|
|
@@ -22,8 +22,7 @@ test('Reverse test 1 ', async () => {
|
|
|
22
22
|
.setSteps(new Map([]));
|
|
23
23
|
|
|
24
24
|
let res = [5, 4, 6, 7];
|
|
25
|
-
await rev.execute(fep);
|
|
26
|
-
expect(src).toStrictEqual(res);
|
|
25
|
+
expect((await rev.execute(fep)).allResults()[0].getResult().get('result')).toStrictEqual(res);
|
|
27
26
|
});
|
|
28
27
|
|
|
29
28
|
test('Reverse test 2 ', async () => {
|
|
@@ -177,8 +176,7 @@ test('Rev test 4', async () => {
|
|
|
177
176
|
res.push(array3);
|
|
178
177
|
res.push(array1);
|
|
179
178
|
|
|
180
|
-
await rev.execute(fep);
|
|
181
|
-
|
|
179
|
+
arr = (await rev.execute(fep)).allResults()[0].getResult().get('result');
|
|
182
180
|
expect(arr).toStrictEqual(res);
|
|
183
181
|
|
|
184
182
|
fep.setArguments(
|
|
@@ -196,8 +194,7 @@ test('Rev test 4', async () => {
|
|
|
196
194
|
res1.push(array2);
|
|
197
195
|
res1.push(array4);
|
|
198
196
|
|
|
199
|
-
await rev.execute(fep);
|
|
200
|
-
expect(arr).toStrictEqual(res1);
|
|
197
|
+
expect((await rev.execute(fep)).allResults()[0].getResult().get('result')).toMatchObject(res1);
|
|
201
198
|
});
|
|
202
199
|
|
|
203
200
|
test('rev test 5', async () => {
|
|
@@ -236,8 +233,7 @@ test('rev test 5', async () => {
|
|
|
236
233
|
res.push('c');
|
|
237
234
|
res.push('a');
|
|
238
235
|
|
|
239
|
-
await rev.execute(fep);
|
|
240
|
-
expect(arr).toStrictEqual(res);
|
|
236
|
+
expect((await rev.execute(fep)).allResults()[0].getResult().get('result')).toStrictEqual(res);
|
|
241
237
|
|
|
242
238
|
fep.setArguments(
|
|
243
239
|
new Map<string, any>([
|
|
@@ -47,9 +47,9 @@ test('Rotate test1 ', async () => {
|
|
|
47
47
|
res.push('using');
|
|
48
48
|
res.push('eclipse');
|
|
49
49
|
|
|
50
|
-
await rotate.execute(fep)
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
expect((await rotate.execute(fep)).allResults()[0].getResult().get('result')).toStrictEqual(
|
|
51
|
+
res,
|
|
52
|
+
);
|
|
53
53
|
});
|
|
54
54
|
|
|
55
55
|
test('rotate test 2', async () => {
|
|
@@ -96,9 +96,9 @@ test('rotate test 2', async () => {
|
|
|
96
96
|
res.push('test');
|
|
97
97
|
res.push('Driven');
|
|
98
98
|
|
|
99
|
-
await rotate.execute(fep)
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
expect((await rotate.execute(fep)).allResults()[0].getResult().get('result')).toStrictEqual(
|
|
100
|
+
res,
|
|
101
|
+
);
|
|
102
102
|
});
|
|
103
103
|
|
|
104
104
|
test('rotate test 3', async () => {
|
|
@@ -141,7 +141,7 @@ test('rotate test 3', async () => {
|
|
|
141
141
|
|
|
142
142
|
res.push('I');
|
|
143
143
|
|
|
144
|
-
await rotate.execute(fep)
|
|
145
|
-
|
|
146
|
-
|
|
144
|
+
expect((await rotate.execute(fep)).allResults()[0].getResult().get('result')).toStrictEqual(
|
|
145
|
+
res,
|
|
146
|
+
);
|
|
147
147
|
});
|
|
@@ -29,7 +29,7 @@ test('sort test 1', async () => {
|
|
|
29
29
|
res.push(15);
|
|
30
30
|
res.push(98);
|
|
31
31
|
|
|
32
|
-
expect((await sort.execute(fep)).allResults()[0].getResult().get('
|
|
32
|
+
expect((await sort.execute(fep)).allResults()[0].getResult().get('result')).toStrictEqual(res);
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
test('sort test 2', async () => {
|
|
@@ -57,7 +57,7 @@ test('sort test 2', async () => {
|
|
|
57
57
|
res.push(15);
|
|
58
58
|
res.push(98);
|
|
59
59
|
|
|
60
|
-
expect((await sort.execute(fep)).allResults()[0].getResult().get('
|
|
60
|
+
expect((await sort.execute(fep)).allResults()[0].getResult().get('result')).toStrictEqual(res);
|
|
61
61
|
});
|
|
62
62
|
|
|
63
63
|
test('sort test 3', async () => {
|
|
@@ -88,7 +88,7 @@ test('sort test 3', async () => {
|
|
|
88
88
|
]),
|
|
89
89
|
);
|
|
90
90
|
|
|
91
|
-
expect((await sort.execute(fep)).allResults()[0].getResult().get('
|
|
91
|
+
expect((await sort.execute(fep)).allResults()[0].getResult().get('result')).toStrictEqual(res);
|
|
92
92
|
});
|
|
93
93
|
|
|
94
94
|
test('sort test 4', async () => {
|
|
@@ -125,7 +125,7 @@ test('sort test 4', async () => {
|
|
|
125
125
|
]),
|
|
126
126
|
);
|
|
127
127
|
|
|
128
|
-
expect((await sort.execute(fep)).allResults()[0].getResult().get('
|
|
128
|
+
expect((await sort.execute(fep)).allResults()[0].getResult().get('result')).toStrictEqual(res);
|
|
129
129
|
});
|
|
130
130
|
|
|
131
131
|
test('sort test 5', async () => {
|
|
@@ -142,5 +142,5 @@ test('sort test 5', async () => {
|
|
|
142
142
|
]),
|
|
143
143
|
);
|
|
144
144
|
let res: any[] = ['Banana', 'Apple', 'Mango', 'Orange'];
|
|
145
|
-
expect((await sort.execute(fep)).allResults()[0].getResult().get('
|
|
145
|
+
expect((await sort.execute(fep)).allResults()[0].getResult().get('result')).toMatchObject(res);
|
|
146
146
|
});
|
|
@@ -48,10 +48,7 @@ test('SubArray of Test 1', async () => {
|
|
|
48
48
|
);
|
|
49
49
|
|
|
50
50
|
expect(
|
|
51
|
-
(await sub.execute(fep))
|
|
52
|
-
.allResults()[0]
|
|
53
|
-
.getResult()
|
|
54
|
-
.get(SubArray.EVENT_RESULT_ARRAY.getName()),
|
|
51
|
+
(await sub.execute(fep)).allResults()[0].getResult().get(SubArray.EVENT_RESULT_NAME),
|
|
55
52
|
).toStrictEqual(res);
|
|
56
53
|
});
|
|
57
54
|
|
|
@@ -112,10 +109,7 @@ test('SubArray of Test 5', async () => {
|
|
|
112
109
|
);
|
|
113
110
|
|
|
114
111
|
expect(
|
|
115
|
-
(await sub.execute(fep))
|
|
116
|
-
.allResults()[0]
|
|
117
|
-
.getResult()
|
|
118
|
-
.get(SubArray.EVENT_RESULT_ARRAY.getName()),
|
|
112
|
+
(await sub.execute(fep)).allResults()[0].getResult().get(SubArray.EVENT_RESULT_NAME),
|
|
119
113
|
).toStrictEqual(res);
|
|
120
114
|
});
|
|
121
115
|
|
|
@@ -253,9 +247,6 @@ test('SubArray of Test 4', async () => {
|
|
|
253
247
|
]),
|
|
254
248
|
);
|
|
255
249
|
expect(
|
|
256
|
-
(await sub.execute(fep))
|
|
257
|
-
|
|
258
|
-
.getResult()
|
|
259
|
-
.get(SubArray.EVENT_RESULT_ARRAY.getName()),
|
|
260
|
-
).toStrictEqual(res);
|
|
250
|
+
(await sub.execute(fep)).allResults()[0].getResult().get(SubArray.EVENT_RESULT_NAME),
|
|
251
|
+
).toMatchObject(res);
|
|
261
252
|
});
|