@fincity/kirun-js 1.0.5 → 1.1.2

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 (118) 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 +60 -25
  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/math/RandomIntTest.ts +46 -0
  30. package/__tests__/engine/function/system/string/ConcatenateTest.ts +4 -4
  31. package/__tests__/engine/function/system/string/DeleteForGivenLengthTest.ts +8 -4
  32. package/__tests__/engine/function/system/string/InsertAtGivenPositionTest.ts +6 -6
  33. package/__tests__/engine/function/system/string/PostPadTest.ts +6 -6
  34. package/__tests__/engine/function/system/string/PrePadTest.ts +8 -8
  35. package/__tests__/engine/function/system/string/RegionMatchesTest.ts +15 -6
  36. package/__tests__/engine/function/system/string/ReverseTest.ts +6 -6
  37. package/__tests__/engine/function/system/string/SplitTest.ts +8 -4
  38. package/__tests__/engine/function/system/string/StringFunctionRepoTest2.ts +35 -11
  39. package/__tests__/engine/function/system/string/StringFunctionRepoTest3.ts +14 -5
  40. package/__tests__/engine/function/system/string/StringFunctionRepositoryTest.ts +40 -16
  41. package/__tests__/engine/function/system/string/ToStringTest.ts +6 -6
  42. package/__tests__/engine/function/system/string/TrimToTest.ts +8 -6
  43. package/__tests__/engine/runtime/KIRuntimeTest.ts +148 -155
  44. package/__tests__/engine/runtime/KIRuntimeWithDefinitionTest.ts +89 -0
  45. package/__tests__/engine/util/LinkedListTest.ts +9 -0
  46. package/dist/index.js +1 -1
  47. package/dist/index.js.map +1 -1
  48. package/dist/module.js +1 -1
  49. package/dist/module.js.map +1 -1
  50. package/dist/types.d.ts +267 -109
  51. package/dist/types.d.ts.map +1 -1
  52. package/package.json +1 -1
  53. package/src/engine/function/AbstractFunction.ts +5 -3
  54. package/src/engine/function/Function.ts +1 -1
  55. package/src/engine/function/system/GenerateEvent.ts +1 -1
  56. package/src/engine/function/system/If.ts +1 -1
  57. package/src/engine/function/system/array/AbstractArrayFunction.ts +5 -0
  58. package/src/engine/function/system/array/Add.ts +1 -1
  59. package/src/engine/function/system/array/AddFirst.ts +1 -1
  60. package/src/engine/function/system/array/BinarySearch.ts +1 -1
  61. package/src/engine/function/system/array/Compare.ts +1 -1
  62. package/src/engine/function/system/array/Copy.ts +1 -1
  63. package/src/engine/function/system/array/Delete.ts +24 -32
  64. package/src/engine/function/system/array/DeleteFirst.ts +1 -1
  65. package/src/engine/function/system/array/DeleteFrom.ts +1 -1
  66. package/src/engine/function/system/array/DeleteLast.ts +1 -1
  67. package/src/engine/function/system/array/Disjoint.ts +1 -1
  68. package/src/engine/function/system/array/Equals.ts +2 -2
  69. package/src/engine/function/system/array/Fill.ts +1 -1
  70. package/src/engine/function/system/array/Frequency.ts +1 -1
  71. package/src/engine/function/system/array/IndexOf.ts +1 -1
  72. package/src/engine/function/system/array/IndexOfArray.ts +1 -1
  73. package/src/engine/function/system/array/Insert.ts +1 -1
  74. package/src/engine/function/system/array/LastIndexOf.ts +1 -1
  75. package/src/engine/function/system/array/LastIndexOfArray.ts +1 -1
  76. package/src/engine/function/system/array/Max.ts +1 -1
  77. package/src/engine/function/system/array/Min.ts +1 -1
  78. package/src/engine/function/system/array/MisMatch.ts +1 -1
  79. package/src/engine/function/system/array/Reverse.ts +1 -1
  80. package/src/engine/function/system/array/Rotate.ts +1 -1
  81. package/src/engine/function/system/array/Shuffle.ts +1 -1
  82. package/src/engine/function/system/array/Sort.ts +1 -1
  83. package/src/engine/function/system/array/SubArray.ts +1 -1
  84. package/src/engine/function/system/context/Create.ts +1 -1
  85. package/src/engine/function/system/context/Get.ts +1 -1
  86. package/src/engine/function/system/context/SetFunction.ts +1 -1
  87. package/src/engine/function/system/loop/CountLoop.ts +1 -1
  88. package/src/engine/function/system/loop/RangeLoop.ts +1 -1
  89. package/src/engine/function/system/math/Add.ts +2 -4
  90. package/src/engine/function/system/math/GenericMathFunction.ts +2 -4
  91. package/src/engine/function/system/math/Hypotenuse.ts +2 -6
  92. package/src/engine/function/system/math/Maximum.ts +2 -4
  93. package/src/engine/function/system/math/Minimum.ts +2 -4
  94. package/src/engine/function/system/math/Random.ts +1 -1
  95. package/src/engine/function/system/math/RandomFloat.ts +56 -0
  96. package/src/engine/function/system/math/RandomInt.ts +56 -0
  97. package/src/engine/function/system/string/AbstractStringFunction.ts +24 -8
  98. package/src/engine/function/system/string/Concatenate.ts +2 -2
  99. package/src/engine/function/system/string/DeleteForGivenLength.ts +25 -15
  100. package/src/engine/function/system/string/InsertAtGivenPosition.ts +17 -7
  101. package/src/engine/function/system/string/PostPad.ts +20 -10
  102. package/src/engine/function/system/string/PrePad.ts +17 -7
  103. package/src/engine/function/system/string/RegionMatches.ts +40 -22
  104. package/src/engine/function/system/string/ReplaceAtGivenPosition.ts +26 -13
  105. package/src/engine/function/system/string/Reverse.ts +4 -3
  106. package/src/engine/function/system/string/Split.ts +13 -4
  107. package/src/engine/function/system/string/ToString.ts +9 -5
  108. package/src/engine/function/system/string/TrimTo.ts +13 -6
  109. package/src/engine/json/schema/Schema.ts +1 -0
  110. package/src/engine/model/Event.ts +15 -0
  111. package/src/engine/model/FunctionDefinition.ts +76 -29
  112. package/src/engine/model/Parameter.ts +11 -0
  113. package/src/engine/model/ParameterReference.ts +8 -1
  114. package/src/engine/model/Position.ts +5 -0
  115. package/src/engine/model/Statement.ts +16 -0
  116. package/src/engine/model/StatementGroup.ts +7 -0
  117. package/src/engine/runtime/KIRuntime.ts +26 -24
  118. package/src/index.ts +71 -20
@@ -1,9 +1,8 @@
1
1
  import { Delete } from '../../../../../src/engine/function/system/array/Delete';
2
2
  import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
3
3
 
4
- test('Delete Test 1', () => {
4
+ test('Delete Test 1', async () => {
5
5
  let delet: Delete = new Delete();
6
-
7
6
  let source: any[] = [12, 14, 15, 9];
8
7
 
9
8
  let secondSource: any[] = [14, 15];
@@ -13,21 +12,20 @@ test('Delete Test 1', () => {
13
12
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters()
14
13
  .setArguments(
15
14
  new Map([
16
- [Delete.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName(), source],
17
- [Delete.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName(), secondSource],
15
+ [Delete.PARAMETER_ARRAY_SOURCE.getParameterName(), source],
16
+ [Delete.PARAMETER_ANY_VAR_ARGS.getParameterName(), secondSource],
18
17
  ]),
19
18
  )
20
19
  .setSteps(new Map([]))
21
20
  .setContext(new Map([]));
22
21
 
23
- delet.execute(fep);
22
+ await delet.execute(fep);
24
23
 
25
24
  expect(source).toStrictEqual(temp);
26
25
  });
27
26
 
28
- test('Delete Test 2', () => {
27
+ test('Delete Test 2', async () => {
29
28
  let delet: Delete = new Delete();
30
-
31
29
  let source: any[] = ['nocode', 'platform', 14];
32
30
 
33
31
  let secondSource: any[] = ['platform'];
@@ -37,21 +35,20 @@ test('Delete Test 2', () => {
37
35
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters()
38
36
  .setArguments(
39
37
  new Map([
40
- [Delete.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName(), source],
41
- [Delete.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName(), secondSource],
38
+ [Delete.PARAMETER_ARRAY_SOURCE.getParameterName(), source],
39
+ [Delete.PARAMETER_ANY_VAR_ARGS.getParameterName(), secondSource],
42
40
  ]),
43
41
  )
44
42
  .setSteps(new Map([]))
45
43
  .setContext(new Map([]));
46
44
 
47
- delet.execute(fep);
45
+ await delet.execute(fep);
48
46
 
49
47
  expect(source).toStrictEqual(temp);
50
48
  });
51
49
 
52
- test('Delete Test 3', () => {
50
+ test('Delete Test 3', async () => {
53
51
  let delet: Delete = new Delete();
54
-
55
52
  let source = undefined;
56
53
 
57
54
  let secondSource: any[] = ['platform'];
@@ -59,19 +56,18 @@ test('Delete Test 3', () => {
59
56
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters()
60
57
  .setArguments(
61
58
  new Map([
62
- [Delete.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName(), source],
63
- [Delete.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName(), secondSource],
59
+ [Delete.PARAMETER_ARRAY_SOURCE.getParameterName(), source],
60
+ [Delete.PARAMETER_ANY_VAR_ARGS.getParameterName(), secondSource],
64
61
  ]),
65
62
  )
66
63
  .setSteps(new Map([]))
67
64
  .setContext(new Map([]));
68
65
 
69
- expect(() => delet.execute(fep)).toThrow();
66
+ await expect(delet.execute(fep)).rejects.toThrow();
70
67
  });
71
68
 
72
- test('Delete Test 3', () => {
69
+ test('Delete Test 3', async () => {
73
70
  let delet: Delete = new Delete();
74
-
75
71
  let source: any[] = ['platform'];
76
72
 
77
73
  let secondSource = undefined;
@@ -79,19 +75,18 @@ test('Delete Test 3', () => {
79
75
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters()
80
76
  .setArguments(
81
77
  new Map([
82
- [Delete.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName(), source],
83
- [Delete.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName(), secondSource],
78
+ [Delete.PARAMETER_ARRAY_SOURCE.getParameterName(), source],
79
+ [Delete.PARAMETER_ANY_VAR_ARGS.getParameterName(), secondSource],
84
80
  ]),
85
81
  )
86
82
  .setSteps(new Map([]))
87
83
  .setContext(new Map([]));
88
84
 
89
- expect(() => delet.execute(fep)).toThrow();
85
+ await expect(delet.execute(fep)).rejects.toThrow();
90
86
  });
91
87
 
92
- test('Delete Test 4', () => {
88
+ test('Delete Test 4', async () => {
93
89
  let delet: Delete = new Delete();
94
-
95
90
  let source: any[] = ['platform'];
96
91
 
97
92
  let secondSource: any[] = [];
@@ -99,12 +94,52 @@ test('Delete Test 4', () => {
99
94
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters()
100
95
  .setArguments(
101
96
  new Map([
102
- [Delete.PARAMETER_ARRAY_SOURCE_PRIMITIVE.getParameterName(), source],
103
- [Delete.PARAMETER_ARRAY_SECOND_SOURCE.getParameterName(), secondSource],
97
+ [Delete.PARAMETER_ARRAY_SOURCE.getParameterName(), source],
98
+ [Delete.PARAMETER_ANY_VAR_ARGS.getParameterName(), secondSource],
99
+ ]),
100
+ )
101
+ .setSteps(new Map([]))
102
+ .setContext(new Map([]));
103
+
104
+ await expect(delet.execute(fep)).rejects.toThrow();
105
+ });
106
+
107
+ test('Delete Test 5', async () => {
108
+ let delet: Delete = new Delete();
109
+
110
+ var arr1: any[] = ['nocode', 'platform', 14];
111
+ var arr2: any[] = ['nocode', 'platiform', 14];
112
+ var obj: object = {
113
+ arr: arr1,
114
+ sri: 'krishna',
115
+ name: 'surendhar',
116
+ };
117
+
118
+ var arr: any[] = [];
119
+ arr.push(arr1);
120
+ arr.push(arr2);
121
+ arr.push(obj);
122
+ arr.push(arr2);
123
+ arr.push(obj);
124
+
125
+ var delArr: any[] = [];
126
+ delArr.push(obj);
127
+ delArr.push('2');
128
+ delArr.push([]);
129
+
130
+ var res: any[] = [arr1, arr2, arr2];
131
+
132
+ let fep: FunctionExecutionParameters = new FunctionExecutionParameters()
133
+ .setArguments(
134
+ new Map([
135
+ [Delete.PARAMETER_ARRAY_SOURCE.getParameterName(), arr],
136
+ [Delete.PARAMETER_ANY_VAR_ARGS.getParameterName(), delArr],
104
137
  ]),
105
138
  )
106
139
  .setSteps(new Map([]))
107
140
  .setContext(new Map([]));
108
141
 
109
- expect(() => delet.execute(fep)).toThrow();
142
+ await delet.execute(fep);
143
+
144
+ expect(arr).toStrictEqual(res);
110
145
  });
@@ -1,7 +1,7 @@
1
1
  import { Disjoint } from '../../../../../src/engine/function/system/array/Disjoint';
2
2
  import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
3
3
 
4
- test('Disjoint Test 1', () => {
4
+ test('Disjoint Test 1', async () => {
5
5
  let dis: Disjoint = new Disjoint();
6
6
 
7
7
  let arr: any[] = [];
@@ -42,8 +42,7 @@ test('Disjoint Test 1', () => {
42
42
  set1.add('p');
43
43
 
44
44
  let set2: Set<any> = new Set<any>();
45
- let res: any[] = dis
46
- .execute(fep)
45
+ let res: any[] = (await dis.execute(fep))
47
46
  .allResults()[0]
48
47
  .getResult()
49
48
  .get(Disjoint.EVENT_RESULT_ARRAY.getName());
@@ -53,7 +52,7 @@ test('Disjoint Test 1', () => {
53
52
  expect(set1).toStrictEqual(set2);
54
53
  });
55
54
 
56
- test('Disjoint Test 2', () => {
55
+ test('Disjoint Test 2', async () => {
57
56
  let dis: Disjoint = new Disjoint();
58
57
 
59
58
  let arr: any[] = [];
@@ -85,10 +84,10 @@ test('Disjoint Test 2', () => {
85
84
  ]),
86
85
  );
87
86
 
88
- expect(() => dis.execute(fep)).toThrow;
87
+ await expect(dis.execute(fep)).rejects.toThrow;
89
88
  });
90
89
 
91
- test('Disjoint test 3', () => {
90
+ test('Disjoint test 3', async () => {
92
91
  let dis: Disjoint = new Disjoint();
93
92
 
94
93
  let array1: any[] = [];
@@ -174,7 +173,7 @@ test('Disjoint test 3', () => {
174
173
  ]),
175
174
  );
176
175
 
177
- var res: any[] = dis.execute(fep).allResults()[0].getResult().get('output');
176
+ var res: any[] = (await dis.execute(fep)).allResults()[0].getResult().get('output');
178
177
 
179
178
  let set2: Set<Object> = new Set<Object>();
180
179
 
@@ -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(() => fill.execute(fep)).toThrow();
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(freq.execute(fep).allResults()[0].getResult().get(Frequency.EVENT_INDEX.getName())).toBe(
35
- 2,
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(() => freq.execute(fep)).toThrow();
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(() => freq.execute(fep)).toThrow();
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(freq.execute(fep).allResults()[0].getResult().get(Frequency.EVENT_INDEX.getName())).toBe(
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(() => ioa.execute(fep)).toThrow();
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).allResults()[0].getResult().get(IndexOf.EVENT_RESULT_INTEGER.getName()),
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(() => ind.execute(fep)).toThrow();
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(ind.execute(fep).allResults()[0].getResult().get(IndexOf.EVENT_INDEX.getName())).toBe(
82
- -1,
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).allResults()[0].getResult().get(IndexOf.EVENT_RESULT_INTEGER.getName()),
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).allResults()[0].getResult().get(IndexOf.EVENT_RESULT_INTEGER.getName()),
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).allResults()[0].getResult().get(IndexOf.EVENT_RESULT_INTEGER.getName()),
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(() => ind.execute(fep)).toThrow();
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(() => ins.execute(fep)).toThrow();
228
+ await expect(ins.execute(fep)).rejects.toThrow();
229
229
  });