@fincity/kirun-js 1.9.1 → 2.0.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 (52) hide show
  1. package/__tests__/engine/function/system/math/MathFunctionRepositoryTest.ts +118 -75
  2. package/__tests__/engine/function/system/string/StringFunctionRepoTest2.ts +3 -3
  3. package/__tests__/engine/function/system/string/StringFunctionRepoTest3.ts +2 -2
  4. package/__tests__/engine/function/system/string/StringFunctionRepositoryTest.ts +8 -8
  5. package/__tests__/engine/json/schema/SchemaUtil.ts +1 -1
  6. package/__tests__/engine/json/schema/type/TypeUtilTest.ts +1 -1
  7. package/__tests__/engine/json/schema/validator/AnyOfAllOfOneOfValidatorTest.ts +24 -19
  8. package/__tests__/engine/json/schema/validator/ArrayContainsValidatorTest.ts +22 -22
  9. package/__tests__/engine/json/schema/validator/ArraySchemaAdapterTypeTest.ts +10 -10
  10. package/__tests__/engine/json/schema/validator/ArraySchemaTypeTest.ts +22 -22
  11. package/__tests__/engine/json/schema/validator/ArrayValidatorTest.ts +13 -13
  12. package/__tests__/engine/json/schema/validator/NotValidatorTest.ts +10 -9
  13. package/__tests__/engine/json/schema/validator/NullValidatorTest.ts +6 -6
  14. package/__tests__/engine/json/schema/validator/ObjectPropertiesTest.ts +4 -4
  15. package/__tests__/engine/json/schema/validator/ObjectValidatorTest.ts +32 -28
  16. package/__tests__/engine/json/schema/validator/SchemaAnyOfValidatorTest.ts +184 -182
  17. package/__tests__/engine/json/schema/validator/SchemaValidatorTest.ts +43 -32
  18. package/__tests__/engine/json/schema/validator/StringFormatSchemaValidatorTest.ts +24 -24
  19. package/__tests__/engine/json/schema/validator/StringValidatorTest.ts +14 -14
  20. package/__tests__/engine/repository/KIRunFunctionRepositoryTest.ts +7 -7
  21. package/__tests__/engine/repository/RepositoryFilterTest.ts +7 -7
  22. package/__tests__/engine/runtime/KIRuntimeFunctionInFunction.ts +11 -7
  23. package/__tests__/engine/runtime/KIRuntimeNoParamMapTest.ts +2 -2
  24. package/__tests__/engine/runtime/KIRuntimeNoValuesTest.ts +2 -2
  25. package/__tests__/engine/runtime/KIRuntimeTest.ts +8 -6
  26. package/__tests__/engine/runtime/KIRuntimeTestWithoutGenEvent.ts +4 -1
  27. package/__tests__/engine/runtime/KIRuntimeUndefinedParamTest.ts +4 -4
  28. package/__tests__/engine/runtime/KIRuntimeValuesEmptyTest.ts +6 -6
  29. package/__tests__/indexTest.ts +10 -10
  30. package/dist/index.js +1 -1
  31. package/dist/index.js.map +1 -1
  32. package/dist/module.js +1 -1
  33. package/dist/module.js.map +1 -1
  34. package/dist/types.d.ts +17 -17
  35. package/dist/types.d.ts.map +1 -1
  36. package/package.json +1 -1
  37. package/src/engine/HybridRepository.ts +5 -5
  38. package/src/engine/Repository.ts +2 -2
  39. package/src/engine/function/AbstractFunction.ts +35 -31
  40. package/src/engine/function/system/array/ArrayFunctionRepository.ts +8 -6
  41. package/src/engine/function/system/math/MathFunctionRepository.ts +7 -5
  42. package/src/engine/function/system/object/ObjectFunctionRepository.ts +7 -5
  43. package/src/engine/function/system/string/StringFunctionRepository.ts +8 -6
  44. package/src/engine/json/schema/SchemaUtil.ts +33 -30
  45. package/src/engine/json/schema/validator/ArrayValidator.ts +25 -20
  46. package/src/engine/json/schema/validator/ObjectValidator.ts +32 -14
  47. package/src/engine/json/schema/validator/SchemaValidator.ts +15 -11
  48. package/src/engine/json/schema/validator/TypeValidator.ts +5 -5
  49. package/src/engine/repository/KIRunFunctionRepository.ts +3 -2
  50. package/src/engine/repository/KIRunSchemaRepository.ts +7 -5
  51. package/src/engine/runtime/KIRuntime.ts +14 -14
  52. package/src/engine/util/duplicate.ts +1 -1
@@ -1,108 +1,151 @@
1
- import { KIRunFunctionRepository, KIRunSchemaRepository } from "../../../../../src";
2
- import { GenericMathFunction } from "../../../../../src/engine/function/system/math/GenericMathFunction";
3
- import { MathFunctionRepository } from "../../../../../src/engine/function/system/math/MathFunctionRepository";
4
- import { Namespaces } from "../../../../../src/engine/namespaces/Namespaces";
5
- import { FunctionExecutionParameters } from "../../../../../src/engine/runtime/FunctionExecutionParameters";
1
+ import { KIRunFunctionRepository, KIRunSchemaRepository } from '../../../../../src';
2
+ import { GenericMathFunction } from '../../../../../src/engine/function/system/math/GenericMathFunction';
3
+ import { MathFunctionRepository } from '../../../../../src/engine/function/system/math/MathFunctionRepository';
4
+ import { Namespaces } from '../../../../../src/engine/namespaces/Namespaces';
5
+ import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
6
6
 
7
7
  const MathFunction: MathFunctionRepository = new MathFunctionRepository();
8
8
 
9
- test("Test Math Functions 1", async () => {
9
+ test('Test Math Functions 1', async () => {
10
10
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
11
11
  new KIRunFunctionRepository(),
12
- new KIRunSchemaRepository()
13
- ).setArguments(
14
- new Map([['value', 1.2]]),
15
- );
16
-
17
- expect((await MathFunction.find(Namespaces.MATH, "Ceiling")?.execute(fep))?.allResults()[0]?.getResult()?.get("value")).toBe(2);
18
- })
19
-
20
- test("Test Math Functions 2", () => {
12
+ new KIRunSchemaRepository(),
13
+ ).setArguments(new Map([['value', 1.2]]));
14
+
15
+ expect(
16
+ (await (await MathFunction.find(Namespaces.MATH, 'Ceiling'))?.execute(fep))
17
+ ?.allResults()[0]
18
+ ?.getResult()
19
+ ?.get('value'),
20
+ ).toBe(2);
21
+ });
22
+
23
+ test('Test Math Functions 2', () => {
21
24
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
22
25
  new KIRunFunctionRepository(),
23
- new KIRunSchemaRepository()
24
- ).setArguments(
25
- new Map([['value', "-1.2"]]),
26
+ new KIRunSchemaRepository(),
27
+ ).setArguments(new Map([['value', '-1.2']]));
28
+
29
+ expect(async () =>
30
+ (await (await MathFunction.find(Namespaces.MATH, 'Absolute'))?.execute(fep))
31
+ ?.allResults()[0]
32
+ ?.getResult()
33
+ ?.get('value'),
34
+ ).rejects.toThrowError(
35
+ 'Value "-1.2" is not of valid type(s)\n-1.2 is not a Integer\n-1.2 is not a Long\n-1.2 is not a Float\n-1.2 is not a Double',
26
36
  );
37
+ });
27
38
 
28
- expect(async () => (await (MathFunction.find(Namespaces.MATH, "Absolute")?.execute(fep)))?.allResults()[0]?.getResult()?.get("value")).rejects.toThrowError("Value \"-1.2\" is not of valid type(s)\n-1.2 is not a Integer\n-1.2 is not a Long\n-1.2 is not a Float\n-1.2 is not a Double");
29
- })
30
-
31
- test("Test Math Functions 3", async () => {
39
+ test('Test Math Functions 3', async () => {
32
40
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
33
41
  new KIRunFunctionRepository(),
34
- new KIRunSchemaRepository()
35
- ).setArguments(
36
- new Map([['value', 90]]),
37
- );
38
-
39
- expect((await MathFunction.find(Namespaces.MATH, "ACosine")?.execute(fep))?.allResults()[0]?.getResult()?.get("value")).toBe(NaN);
40
- })
41
-
42
- test("Test Math Functions 4", () => {
43
- expect(MathFunction.find(Namespaces.STRING, "ASine")).toBe(undefined);
44
- })
45
-
46
- test("test Math Functions 5", () => {
42
+ new KIRunSchemaRepository(),
43
+ ).setArguments(new Map([['value', 90]]));
44
+
45
+ expect(
46
+ (await (await MathFunction.find(Namespaces.MATH, 'ACosine'))?.execute(fep))
47
+ ?.allResults()[0]
48
+ ?.getResult()
49
+ ?.get('value'),
50
+ ).toBe(NaN);
51
+ });
52
+
53
+ test('Test Math Functions 4', async () => {
54
+ expect(await MathFunction.find(Namespaces.STRING, 'ASine')).toBe(undefined);
55
+ });
56
+
57
+ test('test Math Functions 5', () => {
47
58
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
48
59
  new KIRunFunctionRepository(),
49
- new KIRunSchemaRepository()
50
- ).setArguments(
51
- new Map([['value', "-1"]]),
60
+ new KIRunSchemaRepository(),
61
+ ).setArguments(new Map([['value', '-1']]));
62
+
63
+ expect(async () =>
64
+ (await (await MathFunction.find(Namespaces.MATH, 'ATangent'))?.execute(fep))
65
+ ?.allResults()[0]
66
+ ?.getResult()
67
+ ?.get('value'),
68
+ ).rejects.toThrowError(
69
+ 'Value "-1" is not of valid type(s)\n-1 is not a Integer\n-1 is not a Long\n-1 is not a Float\n-1 is not a Double',
52
70
  );
71
+ });
53
72
 
54
- expect(async () => (await MathFunction.find(Namespaces.MATH, "ATangent")?.execute(fep))?.allResults()[0]?.getResult()?.get("value")).rejects.toThrowError("Value \"-1\" is not of valid type(s)\n-1 is not a Integer\n-1 is not a Long\n-1 is not a Float\n-1 is not a Double");
55
- })
56
-
57
- test("test Math Functions 6", async () => {
73
+ test('test Math Functions 6', async () => {
58
74
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
59
75
  new KIRunFunctionRepository(),
60
- new KIRunSchemaRepository()
61
- ).setArguments(
62
- new Map([['value', 1]]),
63
- );
64
-
65
- expect((await MathFunction.find(Namespaces.MATH, "Cosine")?.execute(fep))?.allResults()[0]?.getResult()?.get("value")).toBe(0.5403023058681398);
66
- })
67
-
68
- test("test Math Functions 7", async () => {
76
+ new KIRunSchemaRepository(),
77
+ ).setArguments(new Map([['value', 1]]));
78
+
79
+ expect(
80
+ (await (await MathFunction.find(Namespaces.MATH, 'Cosine'))?.execute(fep))
81
+ ?.allResults()[0]
82
+ ?.getResult()
83
+ ?.get('value'),
84
+ ).toBe(0.5403023058681398);
85
+ });
86
+
87
+ test('test Math Functions 7', async () => {
69
88
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
70
89
  new KIRunFunctionRepository(),
71
- new KIRunSchemaRepository()
90
+ new KIRunSchemaRepository(),
72
91
  ).setArguments(
73
- new Map([['value1', 2], ['value2', 3]]),
92
+ new Map([
93
+ ['value1', 2],
94
+ ['value2', 3],
95
+ ]),
74
96
  );
75
97
 
76
- expect((await MathFunction.find(Namespaces.MATH, "Power")?.execute(fep))?.allResults()[0]?.getResult()?.get("value")).toBe(8);
77
- })
98
+ expect(
99
+ (await (await MathFunction.find(Namespaces.MATH, 'Power'))?.execute(fep))
100
+ ?.allResults()[0]
101
+ ?.getResult()
102
+ ?.get('value'),
103
+ ).toBe(8);
104
+ });
78
105
 
79
- test("test Math Functions 8", () => {
106
+ test('test Math Functions 8', () => {
80
107
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
81
108
  new KIRunFunctionRepository(),
82
- new KIRunSchemaRepository()
109
+ new KIRunSchemaRepository(),
83
110
  ).setArguments(
84
- new Map([['value1', '1'], ['value2', '1']]),
111
+ new Map([
112
+ ['value1', '1'],
113
+ ['value2', '1'],
114
+ ]),
85
115
  );
86
116
 
87
- expect(async () => (await MathFunction.find(Namespaces.MATH, "Power")?.execute(fep))?.allResults()[0]?.getResult()?.get("value")).rejects.toThrowError("Value \"1\" is not of valid type(s)\n1 is not a Integer\n1 is not a Long\n1 is not a Float\n1 is not a Double");
88
- })
117
+ expect(async () =>
118
+ (await (await MathFunction.find(Namespaces.MATH, 'Power'))?.execute(fep))
119
+ ?.allResults()[0]
120
+ ?.getResult()
121
+ ?.get('value'),
122
+ ).rejects.toThrowError(
123
+ 'Value "1" is not of valid type(s)\n1 is not a Integer\n1 is not a Long\n1 is not a Float\n1 is not a Double',
124
+ );
125
+ });
89
126
 
90
- test("test Math Functions 9", async () => {
127
+ test('test Math Functions 9', async () => {
91
128
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
92
129
  new KIRunFunctionRepository(),
93
- new KIRunSchemaRepository()
94
- ).setArguments(
95
- new Map([['value', [3, 2, 3, 5, 3]]]),
96
- );
97
- expect((await MathFunction.find(Namespaces.MATH, "Add")?.execute(fep))?.allResults()[0]?.getResult()?.get("value")).toBe(16);
98
- })
99
-
100
- test("test Math Functions 10", async () => {
130
+ new KIRunSchemaRepository(),
131
+ ).setArguments(new Map([['value', [3, 2, 3, 5, 3]]]));
132
+ expect(
133
+ (await (await MathFunction.find(Namespaces.MATH, 'Add'))?.execute(fep))
134
+ ?.allResults()[0]
135
+ ?.getResult()
136
+ ?.get('value'),
137
+ ).toBe(16);
138
+ });
139
+
140
+ test('test Math Functions 10', async () => {
101
141
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
102
142
  new KIRunFunctionRepository(),
103
- new KIRunSchemaRepository()
104
- ).setArguments(
105
- new Map([['value', [3, 2]]]),
106
- );
107
- expect((await MathFunction.find(Namespaces.MATH, "Hypotenuse")?.execute(fep))?.allResults()[0]?.getResult()?.get("value")).toBe(3.605551275463989);
108
- })
143
+ new KIRunSchemaRepository(),
144
+ ).setArguments(new Map([['value', [3, 2]]]));
145
+ expect(
146
+ (await (await MathFunction.find(Namespaces.MATH, 'Hypotenuse'))?.execute(fep))
147
+ ?.allResults()[0]
148
+ ?.getResult()
149
+ ?.get('value'),
150
+ ).toBe(3.605551275463989);
151
+ });
@@ -8,7 +8,7 @@ import { MapUtil } from '../../../../../src/engine/util/MapUtil';
8
8
  const stringRepo = new StringFunctionRepository();
9
9
 
10
10
  test('StringRepo - contains', async () => {
11
- let fun = stringRepo.find(Namespaces.STRING, 'Contains');
11
+ let fun = await stringRepo.find(Namespaces.STRING, 'Contains');
12
12
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
13
13
  new KIRunFunctionRepository(),
14
14
  new KIRunSchemaRepository(),
@@ -82,7 +82,7 @@ test('StringRepo - contains', async () => {
82
82
  });
83
83
 
84
84
  test('string function repo 2', async () => {
85
- let fun = stringRepo.find(Namespaces.STRING, 'EndsWith');
85
+ let fun = await stringRepo.find(Namespaces.STRING, 'EndsWith');
86
86
 
87
87
  if (!fun) {
88
88
  throw new Error('Function not available');
@@ -141,7 +141,7 @@ test('string function repo 2', async () => {
141
141
  });
142
142
 
143
143
  test('string function repo 3', async () => {
144
- let fun = stringRepo.find(Namespaces.STRING, 'EndsWith');
144
+ let fun = await stringRepo.find(Namespaces.STRING, 'EndsWith');
145
145
 
146
146
  if (!fun) {
147
147
  throw new Error('Function not available');
@@ -8,7 +8,7 @@ import { KIRunFunctionRepository, KIRunSchemaRepository } from '../../../../../s
8
8
  const stringRepo = new StringFunctionRepository();
9
9
 
10
10
  test('StringRepo3 - EqualsIgnoreCase', async () => {
11
- let fun = stringRepo.find(Namespaces.STRING, 'EqualsIgnoreCase');
11
+ let fun = await stringRepo.find(Namespaces.STRING, 'EqualsIgnoreCase');
12
12
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
13
13
  new KIRunFunctionRepository(),
14
14
  new KIRunSchemaRepository(),
@@ -51,7 +51,7 @@ test('StringRepo3 - EqualsIgnoreCase', async () => {
51
51
  });
52
52
 
53
53
  test('StringRepo3 - EqualsIgnoreCase', async () => {
54
- let fun = stringRepo.find(Namespaces.STRING, 'EqualsIgnoreCase');
54
+ let fun = await stringRepo.find(Namespaces.STRING, 'EqualsIgnoreCase');
55
55
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
56
56
  new KIRunFunctionRepository(),
57
57
  new KIRunSchemaRepository(),
@@ -8,7 +8,7 @@ import { KIRunFunctionRepository, KIRunSchemaRepository } from '../../../../../s
8
8
  const repo = new StringFunctionRepository();
9
9
 
10
10
  test('StringFunctionRepository - Trim', async () => {
11
- let fun = repo.find(Namespaces.STRING, 'Trim');
11
+ let fun = await repo.find(Namespaces.STRING, 'Trim');
12
12
  if (!fun) {
13
13
  throw new Error('Function not available');
14
14
  }
@@ -26,7 +26,7 @@ test('StringFunctionRepository - Trim', async () => {
26
26
  });
27
27
 
28
28
  test('StringFunctionRepo -Repeat', async () => {
29
- let fun = repo.find(Namespaces.STRING, 'Repeat');
29
+ let fun = await repo.find(Namespaces.STRING, 'Repeat');
30
30
  if (!fun) {
31
31
  throw new Error('Function not available');
32
32
  }
@@ -53,7 +53,7 @@ test('StringFunctionRepo -Repeat', async () => {
53
53
  });
54
54
 
55
55
  test('StringFunctionRepo -Lowercase', async () => {
56
- let fun = repo.find(Namespaces.STRING, 'LowerCase');
56
+ let fun = await repo.find(Namespaces.STRING, 'LowerCase');
57
57
  if (!fun) {
58
58
  throw new Error('Function not available');
59
59
  }
@@ -79,7 +79,7 @@ test('StringFunctionRepo -Lowercase', async () => {
79
79
  });
80
80
 
81
81
  test('StringFunctionRepo -UpperCase', async () => {
82
- let fun = repo.find(Namespaces.STRING, 'UpperCase');
82
+ let fun = await repo.find(Namespaces.STRING, 'UpperCase');
83
83
  if (!fun) {
84
84
  throw new Error('Function not available');
85
85
  }
@@ -104,7 +104,7 @@ test('StringFunctionRepo -UpperCase', async () => {
104
104
  });
105
105
 
106
106
  test('StringFunctionRepo -Blank1', async () => {
107
- let fun = repo.find(Namespaces.STRING, 'IsBlank');
107
+ let fun = await repo.find(Namespaces.STRING, 'IsBlank');
108
108
  if (!fun) {
109
109
  throw new Error('Function not available');
110
110
  }
@@ -124,7 +124,7 @@ test('StringFunctionRepo -Blank1', async () => {
124
124
  });
125
125
 
126
126
  test('StringFunctionRepo -Blank2', async () => {
127
- let fun = repo.find(Namespaces.STRING, 'IsBlank');
127
+ let fun = await repo.find(Namespaces.STRING, 'IsBlank');
128
128
  if (!fun) {
129
129
  throw new Error('Function not available');
130
130
  }
@@ -149,7 +149,7 @@ test('StringFunctionRepo -Blank2', async () => {
149
149
  });
150
150
 
151
151
  test('StringFunctionRepo -Empty1', async () => {
152
- let fun = repo.find(Namespaces.STRING, 'IsEmpty');
152
+ let fun = await repo.find(Namespaces.STRING, 'IsEmpty');
153
153
  if (!fun) {
154
154
  throw new Error('Function not available');
155
155
  }
@@ -171,7 +171,7 @@ test('StringFunctionRepo -Empty1', async () => {
171
171
  });
172
172
 
173
173
  test('StringFunctionRepo -Empty2', async () => {
174
- let fun = repo.find(Namespaces.STRING, 'IsEmpty');
174
+ let fun = await repo.find(Namespaces.STRING, 'IsEmpty');
175
175
  if (!fun) {
176
176
  throw new Error('Function not available');
177
177
  }
@@ -1,3 +1,3 @@
1
1
  import { SchemaUtil } from '../../../../src';
2
2
 
3
- test('Schema Util Test', () => {});
3
+ test('Schema Util Test', async () => {});
@@ -1,6 +1,6 @@
1
1
  import { SchemaType, TypeUtil } from '../../../../../src';
2
2
 
3
- test('TypeUtilTest', () => {
3
+ test('TypeUtilTest', async () => {
4
4
  expect(TypeUtil.from('OBJECT')?.contains(SchemaType.OBJECT)).toBeTruthy();
5
5
 
6
6
  let type = TypeUtil.from(['OBJECT', 'STRING']);
@@ -1,38 +1,43 @@
1
- import { Schema } from "../../../../../src/engine/json/schema/Schema";
2
- import { SchemaType } from "../../../../../src/engine/json/schema/type/SchemaType";
3
- import { TypeUtil } from "../../../../../src/engine/json/schema/type/TypeUtil";
4
- import { AnyOfAllOfOneOfValidator } from "../../../../../src/engine/json/schema/validator/AnyOfAllOfOneOfValidator";
5
- import { KIRunSchemaRepository } from "../../../../../src/engine/repository/KIRunSchemaRepository";
1
+ import { Schema } from '../../../../../src/engine/json/schema/Schema';
2
+ import { SchemaType } from '../../../../../src/engine/json/schema/type/SchemaType';
3
+ import { TypeUtil } from '../../../../../src/engine/json/schema/type/TypeUtil';
4
+ import { AnyOfAllOfOneOfValidator } from '../../../../../src/engine/json/schema/validator/AnyOfAllOfOneOfValidator';
5
+ import { KIRunSchemaRepository } from '../../../../../src/engine/repository/KIRunSchemaRepository';
6
6
 
7
7
  const repo = new KIRunSchemaRepository();
8
8
 
9
- test("Any Of All Of One Validator Test 1", () => {
9
+ test('Any Of All Of One Validator Test 1', async () => {
10
10
  let schema: Schema = new Schema().setType(TypeUtil.of(SchemaType.INTEGER));
11
11
 
12
12
  expect(AnyOfAllOfOneOfValidator.validate([], schema, repo, 10)).toBe(10);
13
- })
13
+ });
14
14
 
15
- test("Any Of All Of One Validator Test 2", () => {
15
+ test('Any Of All Of One Validator Test 2', async () => {
16
16
  let arraySchema: Schema = new Schema().setType(TypeUtil.of(SchemaType.ARRAY));
17
17
 
18
- expect(AnyOfAllOfOneOfValidator.validate([], arraySchema, repo, [1, 2, 3])).toStrictEqual([1, 2, 3]);
19
- })
18
+ expect(AnyOfAllOfOneOfValidator.validate([], arraySchema, repo, [1, 2, 3])).toStrictEqual([
19
+ 1, 2, 3,
20
+ ]);
21
+ });
20
22
 
21
- test("Any Of All Of One Validator Test 3", () => {
22
- let objSchema: Schema = Schema.ofObject("testObj").setProperties(new Map<string, Schema>([['key', Schema.ofString('key')]]));
23
+ test('Any Of All Of One Validator Test 3', async () => {
24
+ let objSchema: Schema = Schema.ofObject('testObj').setProperties(
25
+ new Map<string, Schema>([['key', Schema.ofString('key')]]),
26
+ );
23
27
 
24
- expect(AnyOfAllOfOneOfValidator.validate([], objSchema, repo, { "key": "value" })).toStrictEqual({ "key": "value" });
25
- })
28
+ expect(AnyOfAllOfOneOfValidator.validate([], objSchema, repo, { key: 'value' })).toStrictEqual({
29
+ key: 'value',
30
+ });
31
+ });
26
32
 
27
- test("Any Of All Of One Validator Test 3", () => {
33
+ test('Any Of All Of One Validator Test 3', async () => {
28
34
  let nullSchema: Schema = new Schema().setType(TypeUtil.of(SchemaType.NULL));
29
35
 
30
36
  expect(AnyOfAllOfOneOfValidator.validate([], nullSchema, repo, null)).toBe(null);
31
- })
37
+ });
32
38
 
33
- test("Any Of All Of One Validator Test 3", () => {
39
+ test('Any Of All Of One Validator Test 3', async () => {
34
40
  let nullSchema: Schema = new Schema().setType(TypeUtil.of(SchemaType.BOOLEAN));
35
41
 
36
42
  expect(AnyOfAllOfOneOfValidator.validate([], nullSchema, repo, null)).toBe(null);
37
- })
38
-
43
+ });
@@ -11,7 +11,7 @@ import {
11
11
 
12
12
  const repo = new KIRunSchemaRepository();
13
13
 
14
- test('schema array contains test ', () => {
14
+ test('schema array contains test ', async () => {
15
15
  let tupleS: Schema[] = [
16
16
  Schema.ofString('item1'),
17
17
  Schema.ofInteger('item2'),
@@ -31,10 +31,10 @@ test('schema array contains test ', () => {
31
31
 
32
32
  let array: any[] = ['jimmy', 31, obj];
33
33
 
34
- expect(ArrayValidator.validate([], schema, repo, array)).toStrictEqual(array);
34
+ expect(await ArrayValidator.validate([], schema, repo, array)).toStrictEqual(array);
35
35
  });
36
36
 
37
- test('schema array error contains test ', () => {
37
+ test('schema array error contains test ', async () => {
38
38
  let tupleS: Schema[] = [
39
39
  Schema.ofString('item1'),
40
40
  Schema.ofInteger('item2'),
@@ -54,12 +54,12 @@ test('schema array error contains test ', () => {
54
54
 
55
55
  let array: any[] = ['jimmy', 31, obj];
56
56
 
57
- expect(() => ArrayValidator.validate([], schema, repo, array)).toThrow(
57
+ expect(ArrayValidator.validate([], schema, repo, array)).rejects.toThrow(
58
58
  'None of the items are of type contains schema',
59
59
  );
60
60
  });
61
61
 
62
- test('schema array min contains test ', () => {
62
+ test('schema array min contains test ', async () => {
63
63
  let tupleS: Schema[] = [
64
64
  Schema.ofString('item1'),
65
65
  Schema.ofInteger('item2'),
@@ -85,10 +85,10 @@ test('schema array min contains test ', () => {
85
85
 
86
86
  let array: any[] = ['jimmy', 31, obj, true, obj1];
87
87
 
88
- expect(ArrayValidator.validate([], schema, repo, array)).toStrictEqual(array);
88
+ expect(await ArrayValidator.validate([], schema, repo, array)).toStrictEqual(array);
89
89
  });
90
90
 
91
- test('schema array max contains test ', () => {
91
+ test('schema array max contains test ', async () => {
92
92
  let tupleS: Schema[] = [
93
93
  Schema.ofString('item1'),
94
94
  Schema.ofInteger('item2'),
@@ -114,10 +114,10 @@ test('schema array max contains test ', () => {
114
114
 
115
115
  let array: any[] = ['jimmy', 31, obj, true, obj1];
116
116
 
117
- expect(ArrayValidator.validate([], schema, repo, array)).toStrictEqual(array);
117
+ expect(await ArrayValidator.validate([], schema, repo, array)).toStrictEqual(array);
118
118
  });
119
119
 
120
- test('schema array min contains test ', () => {
120
+ test('schema array min contains test ', async () => {
121
121
  let tupleS: Schema[] = [
122
122
  Schema.ofString('item1'),
123
123
  Schema.ofInteger('item2'),
@@ -143,14 +143,14 @@ test('schema array min contains test ', () => {
143
143
 
144
144
  let array: any[] = ['jimmy', 31, obj, true, obj1];
145
145
 
146
- expect(() => ArrayValidator.validate([], schema, repo, array)).toThrow(
146
+ expect(ArrayValidator.validate([], schema, repo, array)).rejects.toThrow(
147
147
  'The minimum number of the items of type contains schema should be ' +
148
148
  schema.getMinContains() +
149
149
  ' but found 2',
150
150
  );
151
151
  });
152
152
 
153
- test('schema array max contains test ', () => {
153
+ test('schema array max contains test ', async () => {
154
154
  let tupleS: Schema[] = [
155
155
  Schema.ofString('item1'),
156
156
  Schema.ofInteger('item2'),
@@ -176,14 +176,14 @@ test('schema array max contains test ', () => {
176
176
 
177
177
  let array: any[] = ['jimmy', 31, obj, true, obj1];
178
178
 
179
- expect(() => ArrayValidator.validate([], schema, repo, array)).toThrow(
179
+ expect(ArrayValidator.validate([], schema, repo, array)).rejects.toThrow(
180
180
  'The maximum number of the items of type contains schema should be ' +
181
181
  schema.getMaxContains() +
182
182
  ' but found 2',
183
183
  );
184
184
  });
185
185
 
186
- test('schema array min error contains test ', () => {
186
+ test('schema array min error contains test ', async () => {
187
187
  let tupleS: Schema[] = [
188
188
  Schema.ofString('item1'),
189
189
  Schema.ofInteger('item2'),
@@ -209,14 +209,14 @@ test('schema array min error contains test ', () => {
209
209
 
210
210
  let array: any[] = ['jimmy', 31, obj, true, obj1];
211
211
 
212
- expect(() => ArrayValidator.validate([], schema, repo, array)).toThrow(
212
+ expect(ArrayValidator.validate([], schema, repo, array)).rejects.toThrow(
213
213
  'The minimum number of the items of type contains schema should be ' +
214
214
  schema.getMinContains() +
215
215
  ' but found 2',
216
216
  );
217
217
  });
218
218
 
219
- test('schema array min max contains test ', () => {
219
+ test('schema array min max contains test ', async () => {
220
220
  let tupleS: Schema[] = [
221
221
  Schema.ofString('item1'),
222
222
  Schema.ofInteger('item2'),
@@ -243,10 +243,10 @@ test('schema array min max contains test ', () => {
243
243
 
244
244
  let array: any[] = ['jimmy', 31, obj, true, obj1];
245
245
 
246
- expect(ArrayValidator.validate([], schema, repo, array)).toBe(array);
246
+ expect(await ArrayValidator.validate([], schema, repo, array)).toBe(array);
247
247
  });
248
248
 
249
- test('schema array min max contains test ', () => {
249
+ test('schema array min max contains test ', async () => {
250
250
  let tupleS: Schema[] = [
251
251
  Schema.ofString('item1'),
252
252
  Schema.ofInteger('item2'),
@@ -273,14 +273,14 @@ test('schema array min max contains test ', () => {
273
273
 
274
274
  let array: any[] = ['jimmy', 31, obj, true, obj1];
275
275
 
276
- expect(() => ArrayValidator.validate([], schema, repo, array)).toThrow(
276
+ expect(ArrayValidator.validate([], schema, repo, array)).rejects.toThrow(
277
277
  'The maximum number of the items of type contains schema should be ' +
278
278
  schema.getMaxContains() +
279
279
  ' but found 2',
280
280
  );
281
281
  });
282
282
 
283
- test('schema array min max contains without contains test ', () => {
283
+ test('schema array min max contains without contains test ', async () => {
284
284
  let tupleS: Schema[] = [
285
285
  Schema.ofString('item1'),
286
286
  Schema.ofInteger('item2'),
@@ -306,10 +306,10 @@ test('schema array min max contains without contains test ', () => {
306
306
 
307
307
  let array: any[] = ['jimmy', 31, obj, true, obj1];
308
308
 
309
- expect(ArrayValidator.validate([], schema, repo, array)).toBe(array);
309
+ expect(await ArrayValidator.validate([], schema, repo, array)).toBe(array);
310
310
  });
311
311
 
312
- test('schema array min max contains without contains test ', () => {
312
+ test('schema array min max contains without contains test ', async () => {
313
313
  let tupleS: Schema[] = [
314
314
  Schema.ofString('item1'),
315
315
  Schema.ofInteger('item2'),
@@ -335,5 +335,5 @@ test('schema array min max contains without contains test ', () => {
335
335
 
336
336
  let array: any[] = ['jimmy', 31, obj, true, obj1];
337
337
 
338
- expect(ArrayValidator.validate([], schema, repo, array)).toBe(array);
338
+ expect(await ArrayValidator.validate([], schema, repo, array)).toBe(array);
339
339
  });
@@ -2,7 +2,7 @@ import { KIRunSchemaRepository, SchemaValidator } from '../../../../../src';
2
2
  import { Schema } from '../../../../../src/engine/json/schema/Schema';
3
3
 
4
4
  const repo = new KIRunSchemaRepository();
5
- test('schemaArray With Single Test', () => {
5
+ test('schemaArray With Single Test', async () => {
6
6
  let schema = Schema.from({
7
7
  type: 'ARRAY',
8
8
  items: {
@@ -25,10 +25,10 @@ test('schemaArray With Single Test', () => {
25
25
  'exampleString',
26
26
  ];
27
27
 
28
- expect(() => SchemaValidator.validate([], schema, repo, obj)).toThrow();
28
+ expect(SchemaValidator.validate([], schema, repo, obj)).rejects.toThrow();
29
29
  });
30
30
 
31
- test('schemaArray With out Single fail Test', () => {
31
+ test('schemaArray With out Single fail Test', async () => {
32
32
  let schema = Schema.from({
33
33
  type: 'ARRAY',
34
34
  items: {
@@ -50,10 +50,10 @@ test('schemaArray With out Single fail Test', () => {
50
50
  'exampleString',
51
51
  ];
52
52
 
53
- expect(() => SchemaValidator.validate([], schema, repo, obj)).toThrow();
53
+ expect(SchemaValidator.validate([], schema, repo, obj)).rejects.toThrow();
54
54
  });
55
55
 
56
- test('schemaArrayWithSingle pass Test', () => {
56
+ test('schemaArrayWithSingle pass Test', async () => {
57
57
  let schema = Schema.from({
58
58
  type: 'ARRAY',
59
59
  items: {
@@ -75,10 +75,10 @@ test('schemaArrayWithSingle pass Test', () => {
75
75
  },
76
76
  ];
77
77
 
78
- expect(SchemaValidator.validate([], schema, repo, obj)).toBe(obj);
78
+ expect(await SchemaValidator.validate([], schema, repo, obj)).toBe(obj);
79
79
  });
80
80
 
81
- test('schemaArray With Tuple Test ', () => {
81
+ test('schemaArray With Tuple Test ', async () => {
82
82
  let schema = Schema.from({
83
83
  type: 'ARRAY',
84
84
  items: {
@@ -108,10 +108,10 @@ test('schemaArray With Tuple Test ', () => {
108
108
  'mla',
109
109
  ];
110
110
 
111
- expect(SchemaValidator.validate([], schema, repo, obj)).toBe(obj);
111
+ expect(await SchemaValidator.validate([], schema, repo, obj)).toBe(obj);
112
112
  });
113
113
 
114
- test('schemaArray With out Tuple Test ', () => {
114
+ test('schemaArray With out Tuple Test ', async () => {
115
115
  let schema = Schema.from({
116
116
  type: 'ARRAY',
117
117
  items: [
@@ -137,5 +137,5 @@ test('schemaArray With out Tuple Test ', () => {
137
137
  true,
138
138
  false,
139
139
  ];
140
- expect(SchemaValidator.validate([], schema, repo, obj)).toBe(obj);
140
+ expect(await SchemaValidator.validate([], schema, repo, obj)).toBe(obj);
141
141
  });