@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.
Files changed (107) hide show
  1. package/__tests__/engine/function/system/array/AddFirstTest.ts +13 -12
  2. package/__tests__/engine/function/system/array/AddTest.ts +11 -11
  3. package/__tests__/engine/function/system/array/BinarySearchTest.ts +29 -14
  4. package/__tests__/engine/function/system/array/CompareTest.ts +3 -3
  5. package/__tests__/engine/function/system/array/CopyTest.ts +5 -5
  6. package/__tests__/engine/function/system/array/DeleteFirstTest.ts +10 -10
  7. package/__tests__/engine/function/system/array/DeleteFromTest.ts +8 -8
  8. package/__tests__/engine/function/system/array/DeleteLastTest.ts +10 -10
  9. package/__tests__/engine/function/system/array/DeleteTest.ts +10 -10
  10. package/__tests__/engine/function/system/array/DisjointTest.ts +6 -7
  11. package/__tests__/engine/function/system/array/Equals.ts +5 -5
  12. package/__tests__/engine/function/system/array/FillTest.ts +5 -5
  13. package/__tests__/engine/function/system/array/FrequencyTest.ts +11 -11
  14. package/__tests__/engine/function/system/array/IndexOfArrayTest.ts +14 -20
  15. package/__tests__/engine/function/system/array/IndexOfTest.ts +26 -14
  16. package/__tests__/engine/function/system/array/InsertTest.ts +12 -12
  17. package/__tests__/engine/function/system/array/LastIndexOfArrayTest.ts +9 -12
  18. package/__tests__/engine/function/system/array/LastIndexOfTest.ts +16 -16
  19. package/__tests__/engine/function/system/array/MaxTest.ts +18 -18
  20. package/__tests__/engine/function/system/array/MinTest.ts +18 -18
  21. package/__tests__/engine/function/system/array/MisMatchTest.ts +8 -11
  22. package/__tests__/engine/function/system/array/ReverseTest.ts +12 -12
  23. package/__tests__/engine/function/system/array/RotateTest.ts +6 -6
  24. package/__tests__/engine/function/system/array/ShuffleTest.ts +7 -4
  25. package/__tests__/engine/function/system/array/SortTest.ts +10 -10
  26. package/__tests__/engine/function/system/array/SubArrayTest.ts +19 -10
  27. package/__tests__/engine/function/system/context/SetFunctionTest.ts +24 -5
  28. package/__tests__/engine/function/system/math/AddTest.ts +2 -2
  29. package/__tests__/engine/function/system/string/ConcatenateTest.ts +4 -4
  30. package/__tests__/engine/function/system/string/DeleteForGivenLengthTest.ts +8 -4
  31. package/__tests__/engine/function/system/string/InsertAtGivenPositionTest.ts +6 -6
  32. package/__tests__/engine/function/system/string/PostPadTest.ts +6 -6
  33. package/__tests__/engine/function/system/string/PrePadTest.ts +8 -8
  34. package/__tests__/engine/function/system/string/RegionMatchesTest.ts +15 -6
  35. package/__tests__/engine/function/system/string/ReverseTest.ts +6 -6
  36. package/__tests__/engine/function/system/string/SplitTest.ts +8 -4
  37. package/__tests__/engine/function/system/string/StringFunctionRepoTest2.ts +35 -11
  38. package/__tests__/engine/function/system/string/StringFunctionRepoTest3.ts +14 -5
  39. package/__tests__/engine/function/system/string/StringFunctionRepositoryTest.ts +40 -16
  40. package/__tests__/engine/function/system/string/ToStringTest.ts +6 -6
  41. package/__tests__/engine/function/system/string/TrimToTest.ts +8 -6
  42. package/__tests__/engine/runtime/KIRuntimeTest.ts +148 -155
  43. package/__tests__/engine/util/LinkedListTest.ts +9 -0
  44. package/dist/index.js +1 -1
  45. package/dist/index.js.map +1 -1
  46. package/dist/module.js +1 -1
  47. package/dist/module.js.map +1 -1
  48. package/dist/types.d.ts +344 -109
  49. package/dist/types.d.ts.map +1 -1
  50. package/package.json +7 -5
  51. package/src/engine/function/AbstractFunction.ts +5 -3
  52. package/src/engine/function/Function.ts +1 -1
  53. package/src/engine/function/system/GenerateEvent.ts +1 -1
  54. package/src/engine/function/system/If.ts +1 -1
  55. package/src/engine/function/system/array/Add.ts +1 -1
  56. package/src/engine/function/system/array/AddFirst.ts +1 -1
  57. package/src/engine/function/system/array/BinarySearch.ts +1 -1
  58. package/src/engine/function/system/array/Compare.ts +1 -1
  59. package/src/engine/function/system/array/Copy.ts +1 -1
  60. package/src/engine/function/system/array/Delete.ts +1 -1
  61. package/src/engine/function/system/array/DeleteFirst.ts +1 -1
  62. package/src/engine/function/system/array/DeleteFrom.ts +1 -1
  63. package/src/engine/function/system/array/DeleteLast.ts +1 -1
  64. package/src/engine/function/system/array/Disjoint.ts +1 -1
  65. package/src/engine/function/system/array/Equals.ts +2 -2
  66. package/src/engine/function/system/array/Fill.ts +1 -1
  67. package/src/engine/function/system/array/Frequency.ts +1 -1
  68. package/src/engine/function/system/array/IndexOf.ts +1 -1
  69. package/src/engine/function/system/array/IndexOfArray.ts +1 -1
  70. package/src/engine/function/system/array/Insert.ts +1 -1
  71. package/src/engine/function/system/array/LastIndexOf.ts +1 -1
  72. package/src/engine/function/system/array/LastIndexOfArray.ts +1 -1
  73. package/src/engine/function/system/array/Max.ts +1 -1
  74. package/src/engine/function/system/array/Min.ts +1 -1
  75. package/src/engine/function/system/array/MisMatch.ts +1 -1
  76. package/src/engine/function/system/array/Reverse.ts +1 -1
  77. package/src/engine/function/system/array/Rotate.ts +1 -1
  78. package/src/engine/function/system/array/Shuffle.ts +1 -1
  79. package/src/engine/function/system/array/Sort.ts +1 -1
  80. package/src/engine/function/system/array/SubArray.ts +1 -1
  81. package/src/engine/function/system/context/Create.ts +1 -1
  82. package/src/engine/function/system/context/Get.ts +1 -1
  83. package/src/engine/function/system/context/SetFunction.ts +1 -1
  84. package/src/engine/function/system/loop/CountLoop.ts +1 -1
  85. package/src/engine/function/system/loop/RangeLoop.ts +1 -1
  86. package/src/engine/function/system/math/Add.ts +2 -4
  87. package/src/engine/function/system/math/GenericMathFunction.ts +2 -4
  88. package/src/engine/function/system/math/Hypotenuse.ts +2 -6
  89. package/src/engine/function/system/math/Maximum.ts +2 -4
  90. package/src/engine/function/system/math/Minimum.ts +2 -4
  91. package/src/engine/function/system/math/Random.ts +1 -1
  92. package/src/engine/function/system/string/AbstractStringFunction.ts +24 -8
  93. package/src/engine/function/system/string/Concatenate.ts +2 -2
  94. package/src/engine/function/system/string/DeleteForGivenLength.ts +25 -15
  95. package/src/engine/function/system/string/InsertAtGivenPosition.ts +17 -7
  96. package/src/engine/function/system/string/PostPad.ts +20 -10
  97. package/src/engine/function/system/string/PrePad.ts +17 -7
  98. package/src/engine/function/system/string/RegionMatches.ts +40 -22
  99. package/src/engine/function/system/string/ReplaceAtGivenPosition.ts +26 -13
  100. package/src/engine/function/system/string/Reverse.ts +4 -3
  101. package/src/engine/function/system/string/Split.ts +13 -4
  102. package/src/engine/function/system/string/ToString.ts +9 -5
  103. package/src/engine/function/system/string/TrimTo.ts +13 -6
  104. package/src/engine/runtime/KIRuntime.ts +26 -24
  105. package/src/engine/runtime/expression/operators/binary/index.ts +23 -0
  106. package/src/engine/runtime/expression/operators/unary/index.ts +5 -0
  107. package/src/index.ts +100 -18
@@ -3,7 +3,7 @@ import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/F
3
3
 
4
4
  let max: Max = new Max();
5
5
 
6
- test('max test 1 ', () => {
6
+ test('max test 1 ', async () => {
7
7
  let arr: any[] = [];
8
8
  arr.push(null);
9
9
  arr.push(12);
@@ -12,22 +12,22 @@ test('max test 1 ', () => {
12
12
  new Map([[Max.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName(), arr]]),
13
13
  );
14
14
 
15
- expect(max.execute(fep).allResults()[0].getResult().get(Max.EVENT_RESULT_ANY.getName())).toBe(
16
- 12,
17
- );
15
+ expect(
16
+ (await max.execute(fep)).allResults()[0].getResult().get(Max.EVENT_RESULT_ANY.getName()),
17
+ ).toBe(12);
18
18
  });
19
19
 
20
- test('max test 2 ', () => {
20
+ test('max test 2 ', async () => {
21
21
  let arr: any[] = [];
22
22
 
23
23
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
24
24
  new Map([[Max.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName(), arr]]),
25
25
  );
26
26
 
27
- expect(() => max.execute(fep)).toThrow();
27
+ await expect(max.execute(fep)).rejects.toThrow();
28
28
  });
29
29
 
30
- test('max test 3', () => {
30
+ test('max test 3', async () => {
31
31
  let arr: any[] = [];
32
32
  arr.push(12);
33
33
  arr.push(15);
@@ -38,10 +38,10 @@ test('max test 3', () => {
38
38
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
39
39
  new Map([[Max.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName(), arr]]),
40
40
  );
41
- expect(max.execute(fep).allResults()[0].getResult().get('output')).toBe(98);
41
+ expect((await max.execute(fep)).allResults()[0].getResult().get('output')).toBe(98);
42
42
  });
43
43
 
44
- test('Max test 4', () => {
44
+ test('Max test 4', async () => {
45
45
  let arr: any[] = [];
46
46
  arr.push('nocode');
47
47
  arr.push('NoCode');
@@ -49,17 +49,17 @@ test('Max test 4', () => {
49
49
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
50
50
  new Map([[Max.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName(), arr]]),
51
51
  );
52
- expect(max.execute(fep).allResults()[0].getResult().get('output')).toBe('platform');
52
+ expect((await max.execute(fep)).allResults()[0].getResult().get('output')).toBe('platform');
53
53
  });
54
54
 
55
- test('Max test 6', () => {
55
+ test('Max test 6', async () => {
56
56
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
57
57
  new Map([[Max.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName(), null]]),
58
58
  );
59
- expect(() => max.execute(fep)).toThrow();
59
+ await expect(max.execute(fep)).rejects.toThrow();
60
60
  });
61
61
 
62
- test('Max test 5', () => {
62
+ test('Max test 5', async () => {
63
63
  let arr: any[] = [];
64
64
 
65
65
  arr.push(456);
@@ -72,10 +72,10 @@ test('Max test 5', () => {
72
72
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
73
73
  new Map([[Max.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName(), arr]]),
74
74
  );
75
- expect(max.execute(fep).allResults()[0].getResult().get('output')).toBe('platform');
75
+ expect((await max.execute(fep)).allResults()[0].getResult().get('output')).toBe('platform');
76
76
  });
77
77
 
78
- test('Max test 7', () => {
78
+ test('Max test 7', async () => {
79
79
  let arr1: any[] = [];
80
80
  arr1.push('c');
81
81
  arr1.push('r');
@@ -85,14 +85,14 @@ test('Max test 7', () => {
85
85
  new Map([[Max.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName(), arr1]]),
86
86
  );
87
87
 
88
- expect(max.execute(fep).allResults()[0].getResult().get('output')).toBe('s');
88
+ expect((await max.execute(fep)).allResults()[0].getResult().get('output')).toBe('s');
89
89
  });
90
90
 
91
- test('Max test 8', () => {
91
+ test('Max test 8', async () => {
92
92
  let arr: any[] = ['surendhar'];
93
93
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
94
94
  new Map([[Max.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName(), arr]]),
95
95
  );
96
96
 
97
- expect(max.execute(fep).allResults()[0].getResult().get('output')).toBe('surendhar');
97
+ expect((await max.execute(fep)).allResults()[0].getResult().get('output')).toBe('surendhar');
98
98
  });
@@ -3,7 +3,7 @@ import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/F
3
3
 
4
4
  let min: Min = new Min();
5
5
 
6
- test('min test 1 ', () => {
6
+ test('min test 1 ', async () => {
7
7
  let arr: any[] = [];
8
8
  arr.push(null);
9
9
  arr.push(12);
@@ -12,22 +12,22 @@ test('min test 1 ', () => {
12
12
  new Map([[Min.PARAMETER_ARRAY_SOURCE.getParameterName(), arr]]),
13
13
  );
14
14
 
15
- expect(min.execute(fep).allResults()[0].getResult().get(Min.EVENT_RESULT_ANY.getName())).toBe(
16
- 12,
17
- );
15
+ expect(
16
+ (await min.execute(fep)).allResults()[0].getResult().get(Min.EVENT_RESULT_ANY.getName()),
17
+ ).toBe(12);
18
18
  });
19
19
 
20
- test('min test 2 ', () => {
20
+ test('min test 2 ', async () => {
21
21
  let arr: any[] = [];
22
22
 
23
23
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
24
24
  new Map([[Min.PARAMETER_ARRAY_SOURCE.getParameterName(), arr]]),
25
25
  );
26
26
 
27
- expect(() => min.execute(fep)).toThrow();
27
+ await expect(min.execute(fep)).rejects.toThrow();
28
28
  });
29
29
 
30
- test('min test 3', () => {
30
+ test('min test 3', async () => {
31
31
  let arr: any[] = [];
32
32
  arr.push(12);
33
33
  arr.push(15);
@@ -38,10 +38,10 @@ test('min test 3', () => {
38
38
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
39
39
  new Map([[Min.PARAMETER_ARRAY_SOURCE.getParameterName(), arr]]),
40
40
  );
41
- expect(min.execute(fep).allResults()[0].getResult().get('output')).toBe(1);
41
+ expect((await min.execute(fep)).allResults()[0].getResult().get('output')).toBe(1);
42
42
  });
43
43
 
44
- test('min test 4', () => {
44
+ test('min test 4', async () => {
45
45
  let arr: any[] = [];
46
46
  arr.push('nocode');
47
47
  arr.push('NoCode');
@@ -50,17 +50,17 @@ test('min test 4', () => {
50
50
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
51
51
  new Map([[Min.PARAMETER_ARRAY_SOURCE.getParameterName(), arr]]),
52
52
  );
53
- expect(min.execute(fep).allResults()[0].getResult().get('output')).toBe('NoCode');
53
+ expect((await min.execute(fep)).allResults()[0].getResult().get('output')).toBe('NoCode');
54
54
  });
55
55
 
56
- test('min test 5', () => {
56
+ test('min test 5', async () => {
57
57
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
58
58
  new Map([[Min.PARAMETER_ARRAY_SOURCE.getParameterName(), null]]),
59
59
  );
60
- expect(() => min.execute(fep)).toThrow();
60
+ await expect(min.execute(fep)).rejects.toThrow();
61
61
  });
62
62
 
63
- test('min test 6', () => {
63
+ test('min test 6', async () => {
64
64
  let arr: any[] = [];
65
65
 
66
66
  arr.push(456);
@@ -74,10 +74,10 @@ test('min test 6', () => {
74
74
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
75
75
  new Map([[Min.PARAMETER_ARRAY_SOURCE.getParameterName(), arr]]),
76
76
  );
77
- expect(min.execute(fep).allResults()[0].getResult().get('output')).toBe(1);
77
+ expect((await min.execute(fep)).allResults()[0].getResult().get('output')).toBe(1);
78
78
  });
79
79
 
80
- test('min test 7', () => {
80
+ test('min test 7', async () => {
81
81
  let arr1: any[] = [];
82
82
  arr1.push('c');
83
83
  arr1.push('r');
@@ -87,13 +87,13 @@ test('min test 7', () => {
87
87
  new Map([[Min.PARAMETER_ARRAY_SOURCE.getParameterName(), arr1]]),
88
88
  );
89
89
 
90
- expect(min.execute(fep).allResults()[0].getResult().get('output')).toBe('c');
90
+ expect((await min.execute(fep)).allResults()[0].getResult().get('output')).toBe('c');
91
91
  });
92
92
 
93
- test('min test 8', () => {
93
+ test('min test 8', async () => {
94
94
  let arr: any[] = ['surendhar'];
95
95
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
96
96
  new Map([[Min.PARAMETER_ARRAY_SOURCE.getParameterName(), arr]]),
97
97
  );
98
- expect(min.execute(fep).allResults()[0].getResult().get('output')).toBe('surendhar');
98
+ expect((await min.execute(fep)).allResults()[0].getResult().get('output')).toBe('surendhar');
99
99
  });
@@ -3,7 +3,7 @@ import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/F
3
3
 
4
4
  let mismatch: MisMatch = new MisMatch();
5
5
 
6
- test('mismatch test 1', () => {
6
+ test('mismatch test 1', async () => {
7
7
  let arr: any[] = [];
8
8
  arr.push('a');
9
9
  arr.push('b');
@@ -33,15 +33,14 @@ test('mismatch test 1', () => {
33
33
  );
34
34
 
35
35
  expect(
36
- mismatch
37
- .execute(fep)
36
+ (await mismatch.execute(fep))
38
37
  .allResults()[0]
39
38
  .getResult()
40
39
  .get(MisMatch.EVENT_RESULT_INTEGER.getName()),
41
40
  ).toBe(2);
42
41
  });
43
42
 
44
- test('mismatch test 2', () => {
43
+ test('mismatch test 2', async () => {
45
44
  let arr: any[] = [];
46
45
  arr.push('a');
47
46
  arr.push('b');
@@ -70,10 +69,10 @@ test('mismatch test 2', () => {
70
69
  ]),
71
70
  );
72
71
 
73
- expect(() => mismatch.execute(fep)).toThrow();
72
+ await expect(mismatch.execute(fep)).rejects.toThrow();
74
73
  });
75
74
 
76
- test('Mismatch test 3', () => {
75
+ test('Mismatch test 3', async () => {
77
76
  let array1: any[] = [];
78
77
  array1.push('test');
79
78
  array1.push('Driven');
@@ -168,15 +167,14 @@ test('Mismatch test 3', () => {
168
167
  );
169
168
 
170
169
  expect(
171
- mismatch
172
- .execute(fep)
170
+ (await mismatch.execute(fep))
173
171
  .allResults()[0]
174
172
  .getResult()
175
173
  .get(MisMatch.EVENT_RESULT_INTEGER.getName()),
176
174
  ).toBe(2);
177
175
  });
178
176
 
179
- test('mismatch test 4', () => {
177
+ test('mismatch test 4', async () => {
180
178
  let arr: any[] = [];
181
179
  arr.push('a');
182
180
  arr.push('b');
@@ -206,8 +204,7 @@ test('mismatch test 4', () => {
206
204
  );
207
205
 
208
206
  expect(
209
- mismatch
210
- .execute(fep)
207
+ (await mismatch.execute(fep))
211
208
  .allResults()[0]
212
209
  .getResult()
213
210
  .get(MisMatch.EVENT_RESULT_INTEGER.getName()),
@@ -3,7 +3,7 @@ import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/F
3
3
 
4
4
  let rev: Reverse = new Reverse();
5
5
 
6
- test('Reverse test 1 ', () => {
6
+ test('Reverse test 1 ', async () => {
7
7
  let src: any[] = [4, 5, 6, 7];
8
8
 
9
9
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters()
@@ -18,11 +18,11 @@ test('Reverse test 1 ', () => {
18
18
  .setSteps(new Map([]));
19
19
 
20
20
  let res = [5, 4, 6, 7];
21
- rev.execute(fep);
21
+ await rev.execute(fep);
22
22
  expect(src).toStrictEqual(res);
23
23
  });
24
24
 
25
- test('Reverse test 2 ', () => {
25
+ test('Reverse test 2 ', async () => {
26
26
  let src: any[] = [];
27
27
 
28
28
  src.push('I');
@@ -48,10 +48,10 @@ test('Reverse test 2 ', () => {
48
48
  .setContext(new Map([]))
49
49
  .setSteps(new Map([]));
50
50
 
51
- expect(() => rev.execute(fep)).toThrow();
51
+ await expect(rev.execute(fep)).rejects.toThrow();
52
52
  });
53
53
 
54
- test('Reverse test 3', () => {
54
+ test('Reverse test 3', async () => {
55
55
  let arr: any[] = [];
56
56
  arr.push('a');
57
57
  arr.push('b');
@@ -73,10 +73,10 @@ test('Reverse test 3', () => {
73
73
  [Reverse.PARAMETER_INT_LENGTH.getParameterName(), arr.length],
74
74
  ]),
75
75
  );
76
- expect(() => rev.execute(fep)).toThrow();
76
+ await expect(rev.execute(fep)).rejects.toThrow();
77
77
  });
78
78
 
79
- test('Rev test 4', () => {
79
+ test('Rev test 4', async () => {
80
80
  let array1: any[] = [];
81
81
  array1.push('test');
82
82
  array1.push('Driven');
@@ -164,7 +164,7 @@ test('Rev test 4', () => {
164
164
  res.push(array3);
165
165
  res.push(array1);
166
166
 
167
- rev.execute(fep);
167
+ await rev.execute(fep);
168
168
 
169
169
  expect(arr).toStrictEqual(res);
170
170
 
@@ -183,11 +183,11 @@ test('Rev test 4', () => {
183
183
  res1.push(array2);
184
184
  res1.push(array4);
185
185
 
186
- rev.execute(fep);
186
+ await rev.execute(fep);
187
187
  expect(arr).toStrictEqual(res1);
188
188
  });
189
189
 
190
- test('rev test 5', () => {
190
+ test('rev test 5', async () => {
191
191
  let arr: any[] = [];
192
192
  arr.push('a');
193
193
  arr.push('b');
@@ -220,7 +220,7 @@ test('rev test 5', () => {
220
220
  res.push('c');
221
221
  res.push('a');
222
222
 
223
- rev.execute(fep);
223
+ await rev.execute(fep);
224
224
  expect(arr).toStrictEqual(res);
225
225
 
226
226
  fep.setArguments(
@@ -231,5 +231,5 @@ test('rev test 5', () => {
231
231
  ]),
232
232
  );
233
233
 
234
- expect(() => rev.execute(fep)).toThrow();
234
+ await expect(rev.execute(fep)).rejects.toThrow();
235
235
  });
@@ -3,7 +3,7 @@ import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/F
3
3
 
4
4
  let rotate: Rotate = new Rotate();
5
5
 
6
- test('Rotate test1 ', () => {
6
+ test('Rotate test1 ', async () => {
7
7
  let array: any[] = [];
8
8
  array.push('I');
9
9
  array.push('am');
@@ -43,12 +43,12 @@ test('Rotate test1 ', () => {
43
43
  res.push('using');
44
44
  res.push('eclipse');
45
45
 
46
- rotate.execute(fep);
46
+ await rotate.execute(fep);
47
47
 
48
48
  expect(array).toStrictEqual(res);
49
49
  });
50
50
 
51
- test('rotate test 2', () => {
51
+ test('rotate test 2', async () => {
52
52
  let src: any[] = [];
53
53
 
54
54
  src.push('I');
@@ -89,12 +89,12 @@ test('rotate test 2', () => {
89
89
  res.push('test');
90
90
  res.push('Driven');
91
91
 
92
- rotate.execute(fep);
92
+ await rotate.execute(fep);
93
93
 
94
94
  expect(src).toStrictEqual(res);
95
95
  });
96
96
 
97
- test('rotate test 3', () => {
97
+ test('rotate test 3', async () => {
98
98
  let array: any[] = [];
99
99
  array.push('I');
100
100
  array.push('am');
@@ -131,7 +131,7 @@ test('rotate test 3', () => {
131
131
 
132
132
  res.push('I');
133
133
 
134
- rotate.execute(fep);
134
+ await rotate.execute(fep);
135
135
 
136
136
  expect(array).toStrictEqual(res);
137
137
  });
@@ -3,7 +3,7 @@ import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/F
3
3
 
4
4
  let shuffle: Shuffle = new Shuffle();
5
5
 
6
- test('shuffle test 1', () => {
6
+ test('shuffle test 1', async () => {
7
7
  let array: any[] = [];
8
8
  array.push('I');
9
9
  array.push('am');
@@ -45,14 +45,17 @@ test('shuffle test 1', () => {
45
45
 
46
46
  let set2: Set<any> = new Set<any>();
47
47
 
48
- shuffle.execute(fep).allResults()[0].getResult().get(Shuffle.EVENT_RESULT_EMPTY.getName());
48
+ (await shuffle.execute(fep))
49
+ .allResults()[0]
50
+ .getResult()
51
+ .get(Shuffle.EVENT_RESULT_EMPTY.getName());
49
52
 
50
53
  array.forEach((element) => set2.add(element));
51
54
 
52
55
  expect(set2).toStrictEqual(set1);
53
56
  });
54
57
 
55
- test('Shuffle test 2', () => {
58
+ test('Shuffle test 2', async () => {
56
59
  let array1: any[] = [];
57
60
  array1.push('test');
58
61
  array1.push('Driven');
@@ -144,7 +147,7 @@ test('Shuffle test 2', () => {
144
147
  .setSteps(new Map([]))
145
148
  .setContext(new Map([]));
146
149
 
147
- shuffle.execute(fep);
150
+ await shuffle.execute(fep);
148
151
 
149
152
  let Set2: Set<object> = new Set<Object>();
150
153
 
@@ -3,7 +3,7 @@ import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/F
3
3
 
4
4
  let sort: Sort = new Sort();
5
5
 
6
- test('sort test 1', () => {
6
+ test('sort test 1', async () => {
7
7
  let arr: any[] = [];
8
8
 
9
9
  arr.push(12);
@@ -25,10 +25,10 @@ test('sort test 1', () => {
25
25
  res.push(15);
26
26
  res.push(98);
27
27
 
28
- expect(sort.execute(fep).allResults()[0].getResult().get('output')).toStrictEqual(res);
28
+ expect((await sort.execute(fep)).allResults()[0].getResult().get('output')).toStrictEqual(res);
29
29
  });
30
30
 
31
- test('sort test 2', () => {
31
+ test('sort test 2', async () => {
32
32
  let arr: any[] = [];
33
33
 
34
34
  arr.push(12);
@@ -50,10 +50,10 @@ test('sort test 2', () => {
50
50
  res.push(15);
51
51
  res.push(98);
52
52
 
53
- expect(sort.execute(fep).allResults()[0].getResult().get('output')).toStrictEqual(res);
53
+ expect((await sort.execute(fep)).allResults()[0].getResult().get('output')).toStrictEqual(res);
54
54
  });
55
55
 
56
- test('sort test 3', () => {
56
+ test('sort test 3', async () => {
57
57
  let arr: any[] = [];
58
58
  arr.push(12);
59
59
  arr.push(15);
@@ -78,10 +78,10 @@ test('sort test 3', () => {
78
78
  ]),
79
79
  );
80
80
 
81
- expect(sort.execute(fep).allResults()[0].getResult().get('output')).toStrictEqual(res);
81
+ expect((await sort.execute(fep)).allResults()[0].getResult().get('output')).toStrictEqual(res);
82
82
  });
83
83
 
84
- test('sort test 4', () => {
84
+ test('sort test 4', async () => {
85
85
  let a;
86
86
  let arr: any[] = [];
87
87
  arr.push(12);
@@ -112,10 +112,10 @@ test('sort test 4', () => {
112
112
  ]),
113
113
  );
114
114
 
115
- expect(sort.execute(fep).allResults()[0].getResult().get('output')).toStrictEqual(res);
115
+ expect((await sort.execute(fep)).allResults()[0].getResult().get('output')).toStrictEqual(res);
116
116
  });
117
117
 
118
- test('sort test 5', () => {
118
+ test('sort test 5', async () => {
119
119
  let arr: any[] = ['Banana', 'Orange', 'Apple', 'Mango'];
120
120
 
121
121
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
@@ -126,5 +126,5 @@ test('sort test 5', () => {
126
126
  ]),
127
127
  );
128
128
  let res: any[] = ['Banana', 'Apple', 'Mango', 'Orange'];
129
- expect(sort.execute(fep).allResults()[0].getResult().get('output')).toStrictEqual(res);
129
+ expect((await sort.execute(fep)).allResults()[0].getResult().get('output')).toStrictEqual(res);
130
130
  });
@@ -1,7 +1,7 @@
1
1
  import { SubArray } from '../../../../../src/engine/function/system/array/SubArray';
2
2
  import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
3
3
 
4
- test('SubArray of Test 1', () => {
4
+ test('SubArray of Test 1', async () => {
5
5
  let sub: SubArray = new SubArray();
6
6
 
7
7
  let array: any[] = [];
@@ -44,11 +44,14 @@ test('SubArray of Test 1', () => {
44
44
  );
45
45
 
46
46
  expect(
47
- sub.execute(fep).allResults()[0].getResult().get(SubArray.EVENT_RESULT_ARRAY.getName()),
47
+ (await sub.execute(fep))
48
+ .allResults()[0]
49
+ .getResult()
50
+ .get(SubArray.EVENT_RESULT_ARRAY.getName()),
48
51
  ).toStrictEqual(res);
49
52
  });
50
53
 
51
- test('SubArray of Test 2', () => {
54
+ test('SubArray of Test 2', async () => {
52
55
  let sub: SubArray = new SubArray();
53
56
 
54
57
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters()
@@ -62,10 +65,10 @@ test('SubArray of Test 2', () => {
62
65
  .setSteps(new Map([]))
63
66
  .setContext(new Map([]));
64
67
 
65
- expect(() => sub.execute(fep)).toThrow();
68
+ await expect(sub.execute(fep)).rejects.toThrow();
66
69
  });
67
70
 
68
- test('SubArray of Test 5', () => {
71
+ test('SubArray of Test 5', async () => {
69
72
  let sub: SubArray = new SubArray();
70
73
 
71
74
  let array: any[] = [];
@@ -99,11 +102,14 @@ test('SubArray of Test 5', () => {
99
102
  );
100
103
 
101
104
  expect(
102
- sub.execute(fep).allResults()[0].getResult().get(SubArray.EVENT_RESULT_ARRAY.getName()),
105
+ (await sub.execute(fep))
106
+ .allResults()[0]
107
+ .getResult()
108
+ .get(SubArray.EVENT_RESULT_ARRAY.getName()),
103
109
  ).toStrictEqual(res);
104
110
  });
105
111
 
106
- test('SubArray of Test 3', () => {
112
+ test('SubArray of Test 3', async () => {
107
113
  let sub: SubArray = new SubArray();
108
114
 
109
115
  let array: any[] = [];
@@ -136,10 +142,10 @@ test('SubArray of Test 3', () => {
136
142
  ]),
137
143
  );
138
144
 
139
- expect(() => sub.execute(fep)).toThrow();
145
+ await expect(sub.execute(fep)).rejects.toThrow();
140
146
  });
141
147
 
142
- test('SubArray of Test 4', () => {
148
+ test('SubArray of Test 4', async () => {
143
149
  let sub: SubArray = new SubArray();
144
150
 
145
151
  let array1: any[] = [];
@@ -231,6 +237,9 @@ test('SubArray of Test 4', () => {
231
237
  ]),
232
238
  );
233
239
  expect(
234
- sub.execute(fep).allResults()[0].getResult().get(SubArray.EVENT_RESULT_ARRAY.getName()),
240
+ (await sub.execute(fep))
241
+ .allResults()[0]
242
+ .getResult()
243
+ .get(SubArray.EVENT_RESULT_ARRAY.getName()),
235
244
  ).toStrictEqual(res);
236
245
  });
@@ -3,7 +3,7 @@ import { SetFunction } from '../../../../../src/engine/function/system/context/S
3
3
  import { ContextElement } from '../../../../../src/engine/runtime/ContextElement';
4
4
  import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
5
5
 
6
- test('Set function test 1', () => {
6
+ test('Set function test 1', async () => {
7
7
  let setFunction: SetFunction = new SetFunction();
8
8
 
9
9
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
@@ -18,7 +18,7 @@ test('Set function test 1', () => {
18
18
  ]),
19
19
  );
20
20
 
21
- setFunction.execute(fep);
21
+ await setFunction.execute(fep);
22
22
  expect(contextMap.get('a')?.getElement()['b']).toBe(20);
23
23
 
24
24
  fep.setArguments(
@@ -28,11 +28,11 @@ test('Set function test 1', () => {
28
28
  ]),
29
29
  );
30
30
 
31
- setFunction.execute(fep);
31
+ await setFunction.execute(fep);
32
32
  expect(contextMap.get('a')?.getElement()['c'][2].d).toBe(25);
33
33
  });
34
34
 
35
- test('Set function test 2', () => {
35
+ test('Set function test 2', async () => {
36
36
  let setFunction: SetFunction = new SetFunction();
37
37
 
38
38
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
@@ -47,6 +47,25 @@ test('Set function test 2', () => {
47
47
  ]),
48
48
  );
49
49
 
50
- setFunction.execute(fep);
50
+ await setFunction.execute(fep);
51
51
  expect(contextMap.get('a')?.getElement()[1]).toBe(240);
52
52
  });
53
+
54
+ test('Set function test 3', async () => {
55
+ let setFunction: SetFunction = new SetFunction();
56
+
57
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters();
58
+
59
+ let contextMap: Map<string, ContextElement> = new Map();
60
+ contextMap.set('a', new ContextElement(Schema.ofAny('test'), {}));
61
+ fep.setContext(contextMap);
62
+ fep.setArguments(
63
+ new Map<string, any>([
64
+ ['name', 'Context.a.b[1]'],
65
+ ['value', 240],
66
+ ]),
67
+ );
68
+
69
+ await setFunction.execute(fep);
70
+ expect(contextMap.get('a')?.getElement().b[1]).toBe(240);
71
+ });
@@ -3,10 +3,10 @@ import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/F
3
3
 
4
4
  const add: Add = new Add();
5
5
 
6
- test('add test 1', () => {
6
+ test('add test 1', async () => {
7
7
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters().setArguments(
8
8
  new Map([['value', [1, 2, 3, 4, 5, 6, 5.5]]]),
9
9
  );
10
10
 
11
- expect(add.execute(fep).allResults()[0].getResult().get('value')).toBe(26.5);
11
+ expect((await add.execute(fep)).allResults()[0].getResult().get('value')).toBe(26.5);
12
12
  });