@fincity/kirun-js 1.0.3 → 1.1.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 +13 -12
- package/__tests__/engine/function/system/array/AddTest.ts +11 -11
- package/__tests__/engine/function/system/array/BinarySearchTest.ts +29 -14
- package/__tests__/engine/function/system/array/CompareTest.ts +3 -3
- package/__tests__/engine/function/system/array/CopyTest.ts +5 -5
- package/__tests__/engine/function/system/array/DeleteFirstTest.ts +10 -10
- package/__tests__/engine/function/system/array/DeleteFromTest.ts +8 -8
- package/__tests__/engine/function/system/array/DeleteLastTest.ts +10 -10
- package/__tests__/engine/function/system/array/DeleteTest.ts +10 -10
- package/__tests__/engine/function/system/array/DisjointTest.ts +6 -7
- package/__tests__/engine/function/system/array/Equals.ts +5 -5
- package/__tests__/engine/function/system/array/FillTest.ts +5 -5
- package/__tests__/engine/function/system/array/FrequencyTest.ts +11 -11
- package/__tests__/engine/function/system/array/IndexOfArrayTest.ts +14 -20
- package/__tests__/engine/function/system/array/IndexOfTest.ts +26 -14
- package/__tests__/engine/function/system/array/InsertTest.ts +12 -12
- package/__tests__/engine/function/system/array/LastIndexOfArrayTest.ts +9 -12
- package/__tests__/engine/function/system/array/LastIndexOfTest.ts +16 -16
- package/__tests__/engine/function/system/array/MaxTest.ts +18 -18
- package/__tests__/engine/function/system/array/MinTest.ts +18 -18
- package/__tests__/engine/function/system/array/MisMatchTest.ts +8 -11
- package/__tests__/engine/function/system/array/ReverseTest.ts +12 -12
- package/__tests__/engine/function/system/array/RotateTest.ts +6 -6
- package/__tests__/engine/function/system/array/ShuffleTest.ts +7 -4
- package/__tests__/engine/function/system/array/SortTest.ts +10 -10
- package/__tests__/engine/function/system/array/SubArrayTest.ts +19 -10
- package/__tests__/engine/function/system/context/SetFunctionTest.ts +24 -5
- package/__tests__/engine/function/system/math/AddTest.ts +2 -2
- package/__tests__/engine/function/system/string/ConcatenateTest.ts +4 -4
- package/__tests__/engine/function/system/string/DeleteForGivenLengthTest.ts +8 -4
- package/__tests__/engine/function/system/string/InsertAtGivenPositionTest.ts +6 -6
- package/__tests__/engine/function/system/string/PostPadTest.ts +6 -6
- package/__tests__/engine/function/system/string/PrePadTest.ts +8 -8
- package/__tests__/engine/function/system/string/RegionMatchesTest.ts +15 -6
- package/__tests__/engine/function/system/string/ReverseTest.ts +6 -6
- package/__tests__/engine/function/system/string/SplitTest.ts +8 -4
- package/__tests__/engine/function/system/string/StringFunctionRepoTest2.ts +35 -11
- package/__tests__/engine/function/system/string/StringFunctionRepoTest3.ts +14 -5
- package/__tests__/engine/function/system/string/StringFunctionRepositoryTest.ts +40 -16
- package/__tests__/engine/function/system/string/ToStringTest.ts +6 -6
- package/__tests__/engine/function/system/string/TrimToTest.ts +8 -6
- package/__tests__/engine/runtime/KIRuntimeTest.ts +148 -155
- package/__tests__/engine/util/LinkedListTest.ts +9 -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 +344 -109
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -5
- package/src/engine/function/AbstractFunction.ts +5 -3
- package/src/engine/function/Function.ts +1 -1
- package/src/engine/function/system/GenerateEvent.ts +1 -1
- package/src/engine/function/system/If.ts +1 -1
- package/src/engine/function/system/array/Add.ts +1 -1
- package/src/engine/function/system/array/AddFirst.ts +1 -1
- package/src/engine/function/system/array/BinarySearch.ts +1 -1
- package/src/engine/function/system/array/Compare.ts +1 -1
- package/src/engine/function/system/array/Copy.ts +1 -1
- package/src/engine/function/system/array/Delete.ts +1 -1
- package/src/engine/function/system/array/DeleteFirst.ts +1 -1
- package/src/engine/function/system/array/DeleteFrom.ts +1 -1
- package/src/engine/function/system/array/DeleteLast.ts +1 -1
- package/src/engine/function/system/array/Disjoint.ts +1 -1
- package/src/engine/function/system/array/Equals.ts +2 -2
- package/src/engine/function/system/array/Fill.ts +1 -1
- package/src/engine/function/system/array/Frequency.ts +1 -1
- package/src/engine/function/system/array/IndexOf.ts +1 -1
- package/src/engine/function/system/array/IndexOfArray.ts +1 -1
- package/src/engine/function/system/array/Insert.ts +1 -1
- package/src/engine/function/system/array/LastIndexOf.ts +1 -1
- package/src/engine/function/system/array/LastIndexOfArray.ts +1 -1
- package/src/engine/function/system/array/Max.ts +1 -1
- package/src/engine/function/system/array/Min.ts +1 -1
- package/src/engine/function/system/array/MisMatch.ts +1 -1
- package/src/engine/function/system/array/Reverse.ts +1 -1
- package/src/engine/function/system/array/Rotate.ts +1 -1
- package/src/engine/function/system/array/Shuffle.ts +1 -1
- package/src/engine/function/system/array/Sort.ts +1 -1
- package/src/engine/function/system/array/SubArray.ts +1 -1
- package/src/engine/function/system/context/Create.ts +1 -1
- package/src/engine/function/system/context/Get.ts +1 -1
- package/src/engine/function/system/context/SetFunction.ts +1 -1
- package/src/engine/function/system/loop/CountLoop.ts +1 -1
- package/src/engine/function/system/loop/RangeLoop.ts +1 -1
- package/src/engine/function/system/math/Add.ts +2 -4
- package/src/engine/function/system/math/GenericMathFunction.ts +2 -4
- package/src/engine/function/system/math/Hypotenuse.ts +2 -6
- package/src/engine/function/system/math/Maximum.ts +2 -4
- package/src/engine/function/system/math/Minimum.ts +2 -4
- package/src/engine/function/system/math/Random.ts +1 -1
- package/src/engine/function/system/string/AbstractStringFunction.ts +24 -8
- package/src/engine/function/system/string/Concatenate.ts +2 -2
- package/src/engine/function/system/string/DeleteForGivenLength.ts +25 -15
- package/src/engine/function/system/string/InsertAtGivenPosition.ts +17 -7
- package/src/engine/function/system/string/PostPad.ts +20 -10
- package/src/engine/function/system/string/PrePad.ts +17 -7
- package/src/engine/function/system/string/RegionMatches.ts +40 -22
- package/src/engine/function/system/string/ReplaceAtGivenPosition.ts +26 -13
- package/src/engine/function/system/string/Reverse.ts +4 -3
- package/src/engine/function/system/string/Split.ts +13 -4
- package/src/engine/function/system/string/ToString.ts +9 -5
- package/src/engine/function/system/string/TrimTo.ts +13 -6
- package/src/engine/runtime/KIRuntime.ts +26 -24
- package/src/engine/runtime/expression/operators/binary/index.ts +23 -0
- package/src/engine/runtime/expression/operators/unary/index.ts +5 -0
- package/src/index.ts +100 -18
|
@@ -3,7 +3,7 @@ import { FunctionOutput } from '../../../../../src/engine/model/FunctionOutput';
|
|
|
3
3
|
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
4
4
|
import { MapUtil } from '../../../../../src/engine/util/MapUtil';
|
|
5
5
|
|
|
6
|
-
test('Equals Test', () => {
|
|
6
|
+
test('Equals Test', async () => {
|
|
7
7
|
let equals: Equals = new Equals();
|
|
8
8
|
|
|
9
9
|
let srcArray: any[] = [30, 31, 32, 33, 34];
|
|
@@ -19,13 +19,13 @@ test('Equals Test', () => {
|
|
|
19
19
|
),
|
|
20
20
|
);
|
|
21
21
|
|
|
22
|
-
let fo: FunctionOutput = equals.execute(fep);
|
|
22
|
+
let fo: FunctionOutput = await equals.execute(fep);
|
|
23
23
|
|
|
24
24
|
expect(fo.allResults()[0].getResult().get(Equals.EVENT_RESULT_NAME)).toBeTruthy();
|
|
25
25
|
|
|
26
26
|
findArray[1] = 41;
|
|
27
27
|
|
|
28
|
-
fo = equals.execute(fep);
|
|
28
|
+
fo = await equals.execute(fep);
|
|
29
29
|
|
|
30
30
|
expect(fo.allResults()[0].getResult().get(Equals.EVENT_RESULT_NAME)).toBeFalsy;
|
|
31
31
|
|
|
@@ -43,7 +43,7 @@ test('Equals Test', () => {
|
|
|
43
43
|
),
|
|
44
44
|
);
|
|
45
45
|
|
|
46
|
-
fo = equals.execute(fep);
|
|
46
|
+
fo = await equals.execute(fep);
|
|
47
47
|
|
|
48
48
|
expect(fo.allResults()[0].getResult().get(Equals.EVENT_RESULT_NAME)).toBeTruthy();
|
|
49
49
|
|
|
@@ -61,7 +61,7 @@ test('Equals Test', () => {
|
|
|
61
61
|
),
|
|
62
62
|
);
|
|
63
63
|
|
|
64
|
-
fo = equals.execute(fep);
|
|
64
|
+
fo = await equals.execute(fep);
|
|
65
65
|
|
|
66
66
|
expect(fo.allResults()[0].getResult().get(Equals.EVENT_RESULT_NAME)).toBeTruthy();
|
|
67
67
|
});
|
|
@@ -2,7 +2,7 @@ import { Fill } from '../../../../../src/engine/function/system/array/Fill';
|
|
|
2
2
|
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
3
3
|
import { MapUtil } from '../../../../../src/engine/util/MapUtil';
|
|
4
4
|
|
|
5
|
-
test('Fill Test', () => {
|
|
5
|
+
test('Fill Test', async () => {
|
|
6
6
|
let fill: Fill = new Fill();
|
|
7
7
|
|
|
8
8
|
let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
|
|
@@ -10,7 +10,7 @@ test('Fill Test', () => {
|
|
|
10
10
|
|
|
11
11
|
fep.setArguments(MapUtil.of('source', array as any, 'element', 3));
|
|
12
12
|
|
|
13
|
-
fill.execute(fep);
|
|
13
|
+
await fill.execute(fep);
|
|
14
14
|
expect(array).toStrictEqual([3, 3]);
|
|
15
15
|
|
|
16
16
|
fep.setArguments(MapUtil.of('source', array as any, 'element', 5, 'srcFrom', 2, 'length', 5))
|
|
@@ -18,7 +18,7 @@ test('Fill Test', () => {
|
|
|
18
18
|
.setSteps(MapUtil.of());
|
|
19
19
|
|
|
20
20
|
let finArray = [3, 3, 5, 5, 5, 5, 5];
|
|
21
|
-
fill.execute(fep);
|
|
21
|
+
await fill.execute(fep);
|
|
22
22
|
|
|
23
23
|
expect(array).toStrictEqual(finArray);
|
|
24
24
|
|
|
@@ -26,11 +26,11 @@ test('Fill Test', () => {
|
|
|
26
26
|
|
|
27
27
|
finArray = [3, 3, 5, 5, 5, 25, 25];
|
|
28
28
|
|
|
29
|
-
fill.execute(fep);
|
|
29
|
+
await fill.execute(fep);
|
|
30
30
|
|
|
31
31
|
expect(array).toStrictEqual(finArray);
|
|
32
32
|
|
|
33
33
|
fep.setArguments(MapUtil.of('source', array as any, 'element', 20, 'srcFrom', -1));
|
|
34
34
|
|
|
35
|
-
expect(
|
|
35
|
+
await expect(fill.execute(fep)).rejects.toThrow();
|
|
36
36
|
});
|
|
@@ -3,7 +3,7 @@ import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/F
|
|
|
3
3
|
|
|
4
4
|
let freq: Frequency = new Frequency();
|
|
5
5
|
|
|
6
|
-
test('freq test 1', () => {
|
|
6
|
+
test('freq test 1', async () => {
|
|
7
7
|
let array: any[] = [];
|
|
8
8
|
array.push('test');
|
|
9
9
|
array.push('Driven');
|
|
@@ -31,12 +31,12 @@ test('freq test 1', () => {
|
|
|
31
31
|
]),
|
|
32
32
|
);
|
|
33
33
|
|
|
34
|
-
expect(
|
|
35
|
-
|
|
36
|
-
);
|
|
34
|
+
expect(
|
|
35
|
+
(await freq.execute(fep)).allResults()[0].getResult().get(Frequency.EVENT_INDEX.getName()),
|
|
36
|
+
).toBe(2);
|
|
37
37
|
});
|
|
38
38
|
|
|
39
|
-
test('freq test 2', () => {
|
|
39
|
+
test('freq test 2', async () => {
|
|
40
40
|
let array: any[] = [];
|
|
41
41
|
array.push('test');
|
|
42
42
|
array.push('Driven');
|
|
@@ -66,7 +66,7 @@ test('freq test 2', () => {
|
|
|
66
66
|
]),
|
|
67
67
|
);
|
|
68
68
|
|
|
69
|
-
expect(
|
|
69
|
+
await expect(freq.execute(fep)).rejects.toThrow();
|
|
70
70
|
|
|
71
71
|
fep.setArguments(
|
|
72
72
|
new Map<string, any>([
|
|
@@ -77,10 +77,10 @@ test('freq test 2', () => {
|
|
|
77
77
|
]),
|
|
78
78
|
);
|
|
79
79
|
|
|
80
|
-
expect(
|
|
80
|
+
await expect(freq.execute(fep)).rejects.toThrow();
|
|
81
81
|
});
|
|
82
82
|
|
|
83
|
-
test('freq test 3', () => {
|
|
83
|
+
test('freq test 3', async () => {
|
|
84
84
|
let array: any[] = [];
|
|
85
85
|
let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
|
|
86
86
|
new Map<string, any>([
|
|
@@ -91,7 +91,7 @@ test('freq test 3', () => {
|
|
|
91
91
|
]),
|
|
92
92
|
);
|
|
93
93
|
|
|
94
|
-
expect(
|
|
95
|
-
0,
|
|
96
|
-
);
|
|
94
|
+
expect(
|
|
95
|
+
(await freq.execute(fep)).allResults()[0].getResult().get(Frequency.EVENT_INDEX.getName()),
|
|
96
|
+
).toBe(0);
|
|
97
97
|
});
|
|
@@ -3,7 +3,7 @@ import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/F
|
|
|
3
3
|
|
|
4
4
|
let ioa: IndexOfArray = new IndexOfArray();
|
|
5
5
|
|
|
6
|
-
test('index of array 1', () => {
|
|
6
|
+
test('index of array 1', async () => {
|
|
7
7
|
let arr: any[] = [];
|
|
8
8
|
arr.push('a');
|
|
9
9
|
arr.push('b');
|
|
@@ -29,15 +29,14 @@ test('index of array 1', () => {
|
|
|
29
29
|
);
|
|
30
30
|
|
|
31
31
|
expect(
|
|
32
|
-
ioa
|
|
33
|
-
.execute(fep)
|
|
32
|
+
(await ioa.execute(fep))
|
|
34
33
|
.allResults()[0]
|
|
35
34
|
.getResult()
|
|
36
35
|
.get(IndexOfArray.EVENT_RESULT_INTEGER.getName()),
|
|
37
36
|
).toBe(1);
|
|
38
37
|
});
|
|
39
38
|
|
|
40
|
-
test('Index of array 2', () => {
|
|
39
|
+
test('Index of array 2', async () => {
|
|
41
40
|
let arr: any[] = [];
|
|
42
41
|
arr.push('a');
|
|
43
42
|
arr.push('b');
|
|
@@ -64,15 +63,14 @@ test('Index of array 2', () => {
|
|
|
64
63
|
);
|
|
65
64
|
|
|
66
65
|
expect(
|
|
67
|
-
ioa
|
|
68
|
-
.execute(fep)
|
|
66
|
+
(await ioa.execute(fep))
|
|
69
67
|
.allResults()[0]
|
|
70
68
|
.getResult()
|
|
71
69
|
.get(IndexOfArray.EVENT_RESULT_INTEGER.getName()),
|
|
72
70
|
).toBe(5);
|
|
73
71
|
});
|
|
74
72
|
|
|
75
|
-
test('index of array 3', () => {
|
|
73
|
+
test('index of array 3', async () => {
|
|
76
74
|
let array1: any[] = [];
|
|
77
75
|
array1.push('test');
|
|
78
76
|
array1.push('Driven');
|
|
@@ -161,15 +159,14 @@ test('index of array 3', () => {
|
|
|
161
159
|
);
|
|
162
160
|
|
|
163
161
|
expect(
|
|
164
|
-
ioa
|
|
165
|
-
.execute(fep)
|
|
162
|
+
(await ioa.execute(fep))
|
|
166
163
|
.allResults()[0]
|
|
167
164
|
.getResult()
|
|
168
165
|
.get(IndexOfArray.EVENT_RESULT_INTEGER.getName()),
|
|
169
166
|
).toBe(7);
|
|
170
167
|
});
|
|
171
168
|
|
|
172
|
-
test('index of array test 4', () => {
|
|
169
|
+
test('index of array test 4', async () => {
|
|
173
170
|
let arr: any[] = [];
|
|
174
171
|
arr.push('a');
|
|
175
172
|
arr.push('b');
|
|
@@ -195,15 +192,14 @@ test('index of array test 4', () => {
|
|
|
195
192
|
);
|
|
196
193
|
|
|
197
194
|
expect(
|
|
198
|
-
ioa
|
|
199
|
-
.execute(fep)
|
|
195
|
+
(await ioa.execute(fep))
|
|
200
196
|
.allResults()[0]
|
|
201
197
|
.getResult()
|
|
202
198
|
.get(IndexOfArray.EVENT_RESULT_INTEGER.getName()),
|
|
203
199
|
).toBe(-1);
|
|
204
200
|
});
|
|
205
201
|
|
|
206
|
-
test('index of array 5', () => {
|
|
202
|
+
test('index of array 5', async () => {
|
|
207
203
|
let arr: any[] = [];
|
|
208
204
|
arr.push('a');
|
|
209
205
|
arr.push('b');
|
|
@@ -226,15 +222,14 @@ test('index of array 5', () => {
|
|
|
226
222
|
]),
|
|
227
223
|
);
|
|
228
224
|
expect(
|
|
229
|
-
ioa
|
|
230
|
-
.execute(fep)
|
|
225
|
+
(await ioa.execute(fep))
|
|
231
226
|
.allResults()[0]
|
|
232
227
|
.getResult()
|
|
233
228
|
.get(IndexOfArray.EVENT_RESULT_INTEGER.getName()),
|
|
234
229
|
).toBe(6);
|
|
235
230
|
});
|
|
236
231
|
|
|
237
|
-
test('index of array 6', () => {
|
|
232
|
+
test('index of array 6', async () => {
|
|
238
233
|
let arr: any[] = [];
|
|
239
234
|
arr.push('a');
|
|
240
235
|
arr.push('b');
|
|
@@ -246,10 +241,10 @@ test('index of array 6', () => {
|
|
|
246
241
|
[IndexOfArray.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName(), undefined],
|
|
247
242
|
]),
|
|
248
243
|
);
|
|
249
|
-
expect(
|
|
244
|
+
await expect(ioa.execute(fep)).rejects.toThrow();
|
|
250
245
|
});
|
|
251
246
|
|
|
252
|
-
test('index of array 3', () => {
|
|
247
|
+
test('index of array 3', async () => {
|
|
253
248
|
let array1: any[] = [];
|
|
254
249
|
array1.push('test');
|
|
255
250
|
array1.push('Driven');
|
|
@@ -338,8 +333,7 @@ test('index of array 3', () => {
|
|
|
338
333
|
);
|
|
339
334
|
|
|
340
335
|
expect(
|
|
341
|
-
ioa
|
|
342
|
-
.execute(fep)
|
|
336
|
+
(await ioa.execute(fep))
|
|
343
337
|
.allResults()[0]
|
|
344
338
|
.getResult()
|
|
345
339
|
.get(IndexOfArray.EVENT_RESULT_INTEGER.getName()),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IndexOf } from '../../../../../src/engine/function/system/array/IndexOf';
|
|
2
2
|
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
3
3
|
|
|
4
|
-
test('Index of Test 1', () => {
|
|
4
|
+
test('Index of Test 1', async () => {
|
|
5
5
|
let ind: IndexOf = new IndexOf();
|
|
6
6
|
|
|
7
7
|
let array: string[] = [];
|
|
@@ -33,11 +33,14 @@ test('Index of Test 1', () => {
|
|
|
33
33
|
]),
|
|
34
34
|
);
|
|
35
35
|
expect(
|
|
36
|
-
ind.execute(fep)
|
|
36
|
+
(await ind.execute(fep))
|
|
37
|
+
.allResults()[0]
|
|
38
|
+
.getResult()
|
|
39
|
+
.get(IndexOf.EVENT_RESULT_INTEGER.getName()),
|
|
37
40
|
).toBe(12);
|
|
38
41
|
});
|
|
39
42
|
|
|
40
|
-
test('Index of Test 2', () => {
|
|
43
|
+
test('Index of Test 2', async () => {
|
|
41
44
|
let ind: IndexOf = new IndexOf();
|
|
42
45
|
|
|
43
46
|
let array: string[] = [];
|
|
@@ -69,7 +72,7 @@ test('Index of Test 2', () => {
|
|
|
69
72
|
]),
|
|
70
73
|
);
|
|
71
74
|
|
|
72
|
-
expect(
|
|
75
|
+
await expect(ind.execute(fep)).rejects.toThrow();
|
|
73
76
|
|
|
74
77
|
fep.setArguments(
|
|
75
78
|
new Map<string, any>([
|
|
@@ -78,12 +81,12 @@ test('Index of Test 2', () => {
|
|
|
78
81
|
[IndexOf.PARAMETER_INT_FIND_FROM.getParameterName(), -2],
|
|
79
82
|
]),
|
|
80
83
|
);
|
|
81
|
-
expect(
|
|
82
|
-
|
|
83
|
-
);
|
|
84
|
+
expect(
|
|
85
|
+
(await ind.execute(fep)).allResults()[0].getResult().get(IndexOf.EVENT_INDEX.getName()),
|
|
86
|
+
).toBe(-1);
|
|
84
87
|
});
|
|
85
88
|
|
|
86
|
-
test('Index of Test 3', () => {
|
|
89
|
+
test('Index of Test 3', async () => {
|
|
87
90
|
let ind: IndexOf = new IndexOf();
|
|
88
91
|
|
|
89
92
|
let array: string[] = [];
|
|
@@ -116,11 +119,14 @@ test('Index of Test 3', () => {
|
|
|
116
119
|
);
|
|
117
120
|
|
|
118
121
|
expect(
|
|
119
|
-
ind.execute(fep)
|
|
122
|
+
(await ind.execute(fep))
|
|
123
|
+
.allResults()[0]
|
|
124
|
+
.getResult()
|
|
125
|
+
.get(IndexOf.EVENT_RESULT_INTEGER.getName()),
|
|
120
126
|
).toBe(-1);
|
|
121
127
|
});
|
|
122
128
|
|
|
123
|
-
test('Index of Test 4', () => {
|
|
129
|
+
test('Index of Test 4', async () => {
|
|
124
130
|
let ind: IndexOf = new IndexOf();
|
|
125
131
|
|
|
126
132
|
let array: string[] = [];
|
|
@@ -206,11 +212,14 @@ test('Index of Test 4', () => {
|
|
|
206
212
|
);
|
|
207
213
|
|
|
208
214
|
expect(
|
|
209
|
-
ind.execute(fep)
|
|
215
|
+
(await ind.execute(fep))
|
|
216
|
+
.allResults()[0]
|
|
217
|
+
.getResult()
|
|
218
|
+
.get(IndexOf.EVENT_RESULT_INTEGER.getName()),
|
|
210
219
|
).toBe(2);
|
|
211
220
|
});
|
|
212
221
|
|
|
213
|
-
test('indexof test 5', () => {
|
|
222
|
+
test('indexof test 5', async () => {
|
|
214
223
|
let ind: IndexOf = new IndexOf();
|
|
215
224
|
|
|
216
225
|
let array1: string[] = [];
|
|
@@ -254,7 +263,10 @@ test('indexof test 5', () => {
|
|
|
254
263
|
);
|
|
255
264
|
|
|
256
265
|
expect(
|
|
257
|
-
ind.execute(fep)
|
|
266
|
+
(await ind.execute(fep))
|
|
267
|
+
.allResults()[0]
|
|
268
|
+
.getResult()
|
|
269
|
+
.get(IndexOf.EVENT_RESULT_INTEGER.getName()),
|
|
258
270
|
).toBe(5);
|
|
259
271
|
|
|
260
272
|
fep.setArguments(
|
|
@@ -263,5 +275,5 @@ test('indexof test 5', () => {
|
|
|
263
275
|
[IndexOf.PARAMETER_ANY_NOT_NULL.getParameterName(), null],
|
|
264
276
|
]),
|
|
265
277
|
);
|
|
266
|
-
expect(
|
|
278
|
+
await expect(ind.execute(fep)).rejects.toThrow();
|
|
267
279
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Insert } from '../../../../../src/engine/function/system/array/Insert';
|
|
2
2
|
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
3
3
|
|
|
4
|
-
test('Insert of Test 1', () => {
|
|
4
|
+
test('Insert of Test 1', async () => {
|
|
5
5
|
let ins: Insert = new Insert();
|
|
6
6
|
|
|
7
7
|
let array: any[] = [];
|
|
@@ -54,12 +54,12 @@ test('Insert of Test 1', () => {
|
|
|
54
54
|
res.push('Driven');
|
|
55
55
|
res.push('developement');
|
|
56
56
|
|
|
57
|
-
ins.execute(fep);
|
|
57
|
+
await ins.execute(fep);
|
|
58
58
|
|
|
59
59
|
expect(array).toStrictEqual(res);
|
|
60
60
|
});
|
|
61
61
|
|
|
62
|
-
test('Insert of Test 2', () => {
|
|
62
|
+
test('Insert of Test 2', async () => {
|
|
63
63
|
let ins: Insert = new Insert();
|
|
64
64
|
|
|
65
65
|
let arr: any[] = [];
|
|
@@ -95,12 +95,12 @@ test('Insert of Test 2', () => {
|
|
|
95
95
|
res.push(6);
|
|
96
96
|
res.push(7);
|
|
97
97
|
res.push(8);
|
|
98
|
-
ins.execute(fep);
|
|
98
|
+
await ins.execute(fep);
|
|
99
99
|
|
|
100
100
|
expect(arr).toStrictEqual(res);
|
|
101
101
|
});
|
|
102
102
|
|
|
103
|
-
test('Insert of Test 3', () => {
|
|
103
|
+
test('Insert of Test 3', async () => {
|
|
104
104
|
let ins: Insert = new Insert();
|
|
105
105
|
|
|
106
106
|
let arr: any[] = [];
|
|
@@ -136,12 +136,12 @@ test('Insert of Test 3', () => {
|
|
|
136
136
|
res.push(6);
|
|
137
137
|
res.push(7);
|
|
138
138
|
res.push(8);
|
|
139
|
-
ins.execute(fep);
|
|
139
|
+
await ins.execute(fep);
|
|
140
140
|
|
|
141
141
|
expect(arr).toStrictEqual(res);
|
|
142
142
|
});
|
|
143
143
|
|
|
144
|
-
test('Insert of Test 4', () => {
|
|
144
|
+
test('Insert of Test 4', async () => {
|
|
145
145
|
let ins: Insert = new Insert();
|
|
146
146
|
|
|
147
147
|
let arr: any[] = [];
|
|
@@ -178,12 +178,12 @@ test('Insert of Test 4', () => {
|
|
|
178
178
|
res.push(8);
|
|
179
179
|
res.push(['this is an array']);
|
|
180
180
|
|
|
181
|
-
ins.execute(fep);
|
|
181
|
+
await ins.execute(fep);
|
|
182
182
|
|
|
183
183
|
expect(arr).toStrictEqual(res);
|
|
184
184
|
});
|
|
185
185
|
|
|
186
|
-
test('Insert of Test 5', () => {
|
|
186
|
+
test('Insert of Test 5', async () => {
|
|
187
187
|
let ins: Insert = new Insert();
|
|
188
188
|
|
|
189
189
|
let arr: any[] = [];
|
|
@@ -202,12 +202,12 @@ test('Insert of Test 5', () => {
|
|
|
202
202
|
|
|
203
203
|
res.push(['this is an array']);
|
|
204
204
|
|
|
205
|
-
ins.execute(fep);
|
|
205
|
+
await ins.execute(fep);
|
|
206
206
|
|
|
207
207
|
expect(arr).toStrictEqual(res);
|
|
208
208
|
});
|
|
209
209
|
|
|
210
|
-
test('Insert of Test 6', () => {
|
|
210
|
+
test('Insert of Test 6', async () => {
|
|
211
211
|
let ins: Insert = new Insert();
|
|
212
212
|
|
|
213
213
|
let fep: FunctionExecutionParameters = new FunctionExecutionParameters()
|
|
@@ -225,5 +225,5 @@ test('Insert of Test 6', () => {
|
|
|
225
225
|
|
|
226
226
|
res.push(['this is an array']);
|
|
227
227
|
|
|
228
|
-
expect(
|
|
228
|
+
await expect(ins.execute(fep)).rejects.toThrow();
|
|
229
229
|
});
|
|
@@ -3,7 +3,7 @@ import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/F
|
|
|
3
3
|
|
|
4
4
|
let larr: LastIndexOfArray = new LastIndexOfArray();
|
|
5
5
|
|
|
6
|
-
test('Last Index of array Test 1', () => {
|
|
6
|
+
test('Last Index of array Test 1', async () => {
|
|
7
7
|
let array: string[] = [];
|
|
8
8
|
|
|
9
9
|
array.push('a');
|
|
@@ -32,15 +32,14 @@ test('Last Index of array Test 1', () => {
|
|
|
32
32
|
]),
|
|
33
33
|
);
|
|
34
34
|
expect(
|
|
35
|
-
larr
|
|
36
|
-
.execute(fep)
|
|
35
|
+
(await larr.execute(fep))
|
|
37
36
|
.allResults()[0]
|
|
38
37
|
.getResult()
|
|
39
38
|
.get(LastIndexOfArray.EVENT_RESULT_INTEGER.getName()),
|
|
40
39
|
).toBe(9);
|
|
41
40
|
});
|
|
42
41
|
|
|
43
|
-
test('last index of array test 2', () => {
|
|
42
|
+
test('last index of array test 2', async () => {
|
|
44
43
|
let arr: any[] = [];
|
|
45
44
|
arr.push('b');
|
|
46
45
|
arr.push('c');
|
|
@@ -67,15 +66,14 @@ test('last index of array test 2', () => {
|
|
|
67
66
|
);
|
|
68
67
|
|
|
69
68
|
expect(
|
|
70
|
-
larr
|
|
71
|
-
.execute(fep)
|
|
69
|
+
(await larr.execute(fep))
|
|
72
70
|
.allResults()[0]
|
|
73
71
|
.getResult()
|
|
74
72
|
.get(LastIndexOfArray.EVENT_RESULT_INTEGER.getName()),
|
|
75
73
|
).toBe(-1);
|
|
76
74
|
});
|
|
77
75
|
|
|
78
|
-
test('last index of array test 3', () => {
|
|
76
|
+
test('last index of array test 3', async () => {
|
|
79
77
|
let arr: any[] = [];
|
|
80
78
|
arr.push('a');
|
|
81
79
|
arr.push('b');
|
|
@@ -98,7 +96,7 @@ test('last index of array test 3', () => {
|
|
|
98
96
|
]),
|
|
99
97
|
);
|
|
100
98
|
|
|
101
|
-
expect(
|
|
99
|
+
await expect(larr.execute(fep)).rejects.toThrow();
|
|
102
100
|
|
|
103
101
|
let fep1: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
|
|
104
102
|
new Map<string, any>([
|
|
@@ -108,10 +106,10 @@ test('last index of array test 3', () => {
|
|
|
108
106
|
]),
|
|
109
107
|
);
|
|
110
108
|
|
|
111
|
-
expect(
|
|
109
|
+
await expect(larr.execute(fep1)).rejects.toThrow();
|
|
112
110
|
});
|
|
113
111
|
|
|
114
|
-
test('last index of array test 4', () => {
|
|
112
|
+
test('last index of array test 4', async () => {
|
|
115
113
|
let array1: any[] = [];
|
|
116
114
|
|
|
117
115
|
array1.push('test');
|
|
@@ -204,8 +202,7 @@ test('last index of array test 4', () => {
|
|
|
204
202
|
);
|
|
205
203
|
|
|
206
204
|
expect(
|
|
207
|
-
larr
|
|
208
|
-
.execute(fep)
|
|
205
|
+
(await larr.execute(fep))
|
|
209
206
|
.allResults()[0]
|
|
210
207
|
.getResult()
|
|
211
208
|
.get(LastIndexOfArray.EVENT_RESULT_INTEGER.getName()),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LastIndexOf } from '../../../../../src/engine/function/system/array/LastIndexOf';
|
|
2
2
|
import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
|
|
3
3
|
|
|
4
|
-
test('Last Index of Test 1', () => {
|
|
4
|
+
test('Last Index of Test 1', async () => {
|
|
5
5
|
let lind: LastIndexOf = new LastIndexOf();
|
|
6
6
|
|
|
7
7
|
let array: string[] = [];
|
|
@@ -33,15 +33,14 @@ test('Last Index of Test 1', () => {
|
|
|
33
33
|
]),
|
|
34
34
|
);
|
|
35
35
|
expect(
|
|
36
|
-
lind
|
|
37
|
-
.execute(fep)
|
|
36
|
+
(await lind.execute(fep))
|
|
38
37
|
.allResults()[0]
|
|
39
38
|
.getResult()
|
|
40
39
|
.get(LastIndexOf.EVENT_RESULT_INTEGER.getName()),
|
|
41
40
|
).toBe(13);
|
|
42
41
|
});
|
|
43
42
|
|
|
44
|
-
test('Last Index of Test 2', () => {
|
|
43
|
+
test('Last Index of Test 2', async () => {
|
|
45
44
|
let lind: LastIndexOf = new LastIndexOf();
|
|
46
45
|
|
|
47
46
|
let array: string[] = [];
|
|
@@ -72,10 +71,10 @@ test('Last Index of Test 2', () => {
|
|
|
72
71
|
[LastIndexOf.PARAMETER_INT_FIND_FROM.getParameterName(), 2],
|
|
73
72
|
]),
|
|
74
73
|
);
|
|
75
|
-
expect(
|
|
74
|
+
await expect(lind.execute(fep)).rejects.toThrow();
|
|
76
75
|
});
|
|
77
76
|
|
|
78
|
-
test('Last Index of Test 3', () => {
|
|
77
|
+
test('Last Index of Test 3', async () => {
|
|
79
78
|
let lind: LastIndexOf = new LastIndexOf();
|
|
80
79
|
|
|
81
80
|
let array: string[] = [];
|
|
@@ -106,10 +105,10 @@ test('Last Index of Test 3', () => {
|
|
|
106
105
|
[LastIndexOf.PARAMETER_INT_FIND_FROM.getParameterName(), 2],
|
|
107
106
|
]),
|
|
108
107
|
);
|
|
109
|
-
expect(
|
|
108
|
+
await expect(lind.execute(fep)).rejects.toThrow();
|
|
110
109
|
});
|
|
111
110
|
|
|
112
|
-
test('Last Index of Test 4', () => {
|
|
111
|
+
test('Last Index of Test 4', async () => {
|
|
113
112
|
let lind: LastIndexOf = new LastIndexOf();
|
|
114
113
|
|
|
115
114
|
let array: string[] = [];
|
|
@@ -141,8 +140,7 @@ test('Last Index of Test 4', () => {
|
|
|
141
140
|
]),
|
|
142
141
|
);
|
|
143
142
|
expect(
|
|
144
|
-
lind
|
|
145
|
-
.execute(fep)
|
|
143
|
+
(await lind.execute(fep))
|
|
146
144
|
.allResults()[0]
|
|
147
145
|
.getResult()
|
|
148
146
|
.get(LastIndexOf.EVENT_RESULT_INTEGER.getName()),
|
|
@@ -156,15 +154,14 @@ test('Last Index of Test 4', () => {
|
|
|
156
154
|
]),
|
|
157
155
|
);
|
|
158
156
|
expect(
|
|
159
|
-
lind
|
|
160
|
-
.execute(fep)
|
|
157
|
+
(await lind.execute(fep))
|
|
161
158
|
.allResults()[0]
|
|
162
159
|
.getResult()
|
|
163
160
|
.get(LastIndexOf.EVENT_RESULT_INTEGER.getName()),
|
|
164
161
|
).toBe(-1);
|
|
165
162
|
});
|
|
166
163
|
|
|
167
|
-
test('Last Index of Test 5', () => {
|
|
164
|
+
test('Last Index of Test 5', async () => {
|
|
168
165
|
let lind: LastIndexOf = new LastIndexOf();
|
|
169
166
|
|
|
170
167
|
let array: string[] = [];
|
|
@@ -195,10 +192,10 @@ test('Last Index of Test 5', () => {
|
|
|
195
192
|
[LastIndexOf.PARAMETER_INT_FIND_FROM.getParameterName(), -2],
|
|
196
193
|
]),
|
|
197
194
|
);
|
|
198
|
-
expect(
|
|
195
|
+
await expect(lind.execute(fep)).rejects.toThrow();
|
|
199
196
|
});
|
|
200
197
|
|
|
201
|
-
test('Last Index of Test 6', () => {
|
|
198
|
+
test('Last Index of Test 6', async () => {
|
|
202
199
|
let lind: LastIndexOf = new LastIndexOf();
|
|
203
200
|
|
|
204
201
|
let arr: any[] = [];
|
|
@@ -248,6 +245,9 @@ test('Last Index of Test 6', () => {
|
|
|
248
245
|
]),
|
|
249
246
|
);
|
|
250
247
|
expect(
|
|
251
|
-
lind.execute(fep)
|
|
248
|
+
(await lind.execute(fep))
|
|
249
|
+
.allResults()[0]
|
|
250
|
+
.getResult()
|
|
251
|
+
.get(LastIndexOf.EVENT_RESULT_EMPTY.getName()),
|
|
252
252
|
).toBe(4);
|
|
253
253
|
});
|