@fincity/kirun-js 2.4.0 → 2.7.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 (39) hide show
  1. package/__tests__/engine/function/system/math/MathFunctionRepositoryTest.ts +9 -18
  2. package/__tests__/engine/function/system/math/MaximumTest.ts +3 -2
  3. package/__tests__/engine/function/system/math/MinimumTest.ts +18 -20
  4. package/__tests__/engine/json/schema/covnertor/BooleanConvertorTest.ts +55 -0
  5. package/__tests__/engine/json/schema/covnertor/NullConvertorTest.ts +47 -0
  6. package/__tests__/engine/json/schema/covnertor/NumberConvertorTest.ts +154 -0
  7. package/__tests__/engine/json/schema/covnertor/StringConvertorTest.ts +56 -0
  8. package/__tests__/engine/json/schema/validator/AnyOfAllOfOneOfValidatorTest.ts +9 -7
  9. package/__tests__/engine/json/schema/validator/NotValidatorTest.ts +3 -3
  10. package/__tests__/engine/json/schema/validator/StringValidatorTest.ts +1 -9
  11. package/__tests__/engine/json/schema/validator/TypeValidatorTest.ts +290 -0
  12. package/__tests__/engine/runtime/expression/ExpressionEvaluationTest.ts +80 -0
  13. package/__tests__/engine/runtime/expression/ExpressionEvaluatorStringLiteralTest.ts +73 -1
  14. package/dist/index.js +1 -1
  15. package/dist/index.js.map +1 -1
  16. package/dist/module.js +1 -1
  17. package/dist/module.js.map +1 -1
  18. package/dist/types.d.ts +14 -8
  19. package/dist/types.d.ts.map +1 -1
  20. package/generator/generateValidationCSV.ts +6 -1
  21. package/generator/validation-js.csv +0 -0
  22. package/package.json +4 -1
  23. package/src/engine/function/system/object/ObjectConvert.ts +73 -0
  24. package/src/engine/function/system/object/ObjectPutValue.ts +0 -2
  25. package/src/engine/json/schema/convertor/BooleanConvertor.ts +76 -0
  26. package/src/engine/json/schema/convertor/NullConvertor.ts +31 -0
  27. package/src/engine/json/schema/convertor/NumberConvertor.ts +117 -0
  28. package/src/engine/json/schema/convertor/StringConvertor.ts +41 -0
  29. package/src/engine/json/schema/convertor/enums/ConversionMode.ts +11 -0
  30. package/src/engine/json/schema/convertor/exception/SchemaConversionException.ts +39 -0
  31. package/src/engine/json/schema/validator/AnyOfAllOfOneOfValidator.ts +96 -36
  32. package/src/engine/json/schema/validator/ArrayValidator.ts +15 -7
  33. package/src/engine/json/schema/validator/ObjectValidator.ts +24 -13
  34. package/src/engine/json/schema/validator/SchemaValidator.ts +74 -22
  35. package/src/engine/json/schema/validator/TypeValidator.ts +136 -23
  36. package/src/engine/runtime/expression/tokenextractor/TokenValueExtractor.ts +63 -59
  37. package/src/engine/util/json/ConvertorUtil.ts +51 -0
  38. package/src/engine/util/json/ValidatorUtil.ts +29 -0
  39. package/tsconfig.json +2 -1
@@ -1,5 +1,4 @@
1
1
  import { KIRunFunctionRepository, KIRunSchemaRepository } from '../../../../../src';
2
- import { GenericMathFunction } from '../../../../../src/engine/function/system/math/GenericMathFunction';
3
2
  import { MathFunctionRepository } from '../../../../../src/engine/function/system/math/MathFunctionRepository';
4
3
  import { Namespaces } from '../../../../../src/engine/namespaces/Namespaces';
5
4
  import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
@@ -32,7 +31,7 @@ test('Test Math Functions 2', () => {
32
31
  ?.getResult()
33
32
  ?.get('value'),
34
33
  ).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',
34
+ 'Error while executing the function System.Math.Absolute\'s parameter value with step name \'Unknown Step\' with error : Value \"-1.2\" is not of valid type(s)\n-1.2 is not a Double\n-1.2 is not a Float\n-1.2 is not a Long\n-1.2 is not a Integer',
36
35
  );
37
36
  });
38
37
 
@@ -42,32 +41,24 @@ test('Test Math Functions 3', async () => {
42
41
  new KIRunSchemaRepository(),
43
42
  ).setArguments(new Map([['value', 90]]));
44
43
 
45
- expect(
46
- (await (await MathFunction.find(Namespaces.MATH, 'ACosine'))?.execute(fep))
47
- ?.allResults()[0]
48
- ?.getResult()
49
- ?.get('value'),
50
- ).toBe(NaN);
44
+ const func = await MathFunction.find(Namespaces.MATH, 'ACosine');
45
+ if (!func)
46
+ expect(func).toBe(undefined);
51
47
  });
52
48
 
53
49
  test('Test Math Functions 4', async () => {
54
50
  expect(await MathFunction.find(Namespaces.STRING, 'ASine')).toBe(undefined);
55
51
  });
56
52
 
57
- test('test Math Functions 5', () => {
53
+ test('test Math Functions 5', async () => {
58
54
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
59
55
  new KIRunFunctionRepository(),
60
56
  new KIRunSchemaRepository(),
61
57
  ).setArguments(new Map([['value', '-1']]));
62
58
 
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',
70
- );
59
+ const func = await MathFunction.find(Namespaces.MATH, 'ATangent');
60
+ if (!func)
61
+ expect(func).toBe(undefined);
71
62
  });
72
63
 
73
64
  test('test Math Functions 6', async () => {
@@ -120,7 +111,7 @@ test('test Math Functions 8', () => {
120
111
  ?.getResult()
121
112
  ?.get('value'),
122
113
  ).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',
114
+ 'Error while executing the function System.Math.Power\'s parameter value1 with step name \'Unknown Step\' with error : Value \"1\" is not of valid type(s)\n1 is not a Double\n1 is not a Float\n1 is not a Long\n1 is not a Integer',
124
115
  );
125
116
  });
126
117
 
@@ -34,5 +34,6 @@ test('Minimum Test 3', () => {
34
34
  new Map([['value', ["-1", -1, 0, -1, -2]]]),
35
35
  )
36
36
 
37
- expect(async () => (await max.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");
38
- })
37
+ expect(async () => (await max.execute(fep)).allResults()[0].getResult().get('value')).rejects
38
+ .toThrowError("Error while executing the function System.Math.Maximum's parameter value with step name 'Unknown Step' with error : Value \"-1\" is not of valid type(s)\n-1 is not a Double\n-1 is not a Float\n-1 is not a Long\n-1 is not a Integer");
39
+ })
@@ -1,4 +1,4 @@
1
- import { Minimum } from "../../../../../src/engine/function/system/math/Minimum";
1
+ import { Minimum } from '../../../../../src/engine/function/system/math/Minimum';
2
2
  import { FunctionExecutionParameters } from '../../../../../src/engine/runtime/FunctionExecutionParameters';
3
3
  import { KIRunFunctionRepository, KIRunSchemaRepository } from '../../../../../src';
4
4
 
@@ -6,33 +6,31 @@ const min = new Minimum();
6
6
 
7
7
  test('Minimum Test 1', async () => {
8
8
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
9
- new KIRunFunctionRepository,
10
- new KIRunSchemaRepository
11
- ).setArguments(
12
- new Map([['value', [3, 2, 3, 5, 3]]]),
13
- )
9
+ new KIRunFunctionRepository(),
10
+ new KIRunSchemaRepository(),
11
+ ).setArguments(new Map([['value', [3, 2, 3, 5, 3]]]));
14
12
 
15
13
  expect((await min.execute(fep)).allResults()[0].getResult().get('value')).toBe(2);
16
- })
14
+ });
17
15
 
18
16
  test('Minimum Test 2', () => {
19
17
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
20
- new KIRunFunctionRepository,
21
- new KIRunSchemaRepository
22
- ).setArguments(
23
- new Map([['value', ["3", 2, 3, 5, 3]]]),
24
- )
18
+ new KIRunFunctionRepository(),
19
+ new KIRunSchemaRepository(),
20
+ ).setArguments(new Map([['value', ['3', 2, 3, 5, 3]]]));
25
21
 
26
- expect(async () => (await min.execute(fep)).allResults()[0].getResult().get('value')).rejects.toThrowError("Value \"3\" is not of valid type(s)\n3 is not a Integer\n3 is not a Long\n3 is not a Float\n3 is not a Double");
27
- })
22
+ expect(async () =>
23
+ (await min.execute(fep)).allResults()[0].getResult().get('value'),
24
+ ).rejects.toThrowError(
25
+ "Error while executing the function System.Math.Minimum's parameter value with step name 'Unknown Step' with error : Value \"3\" is not of valid type(s)\n3 is not a Double\n3 is not a Float\n3 is not a Long\n3 is not a Integer",
26
+ );
27
+ });
28
28
 
29
29
  test('Minimum Test 3', async () => {
30
30
  let fep: FunctionExecutionParameters = new FunctionExecutionParameters(
31
- new KIRunFunctionRepository,
32
- new KIRunSchemaRepository
33
- ).setArguments(
34
- new Map([['value', [-1, -2, -3, -5, -3]]]),
35
- )
31
+ new KIRunFunctionRepository(),
32
+ new KIRunSchemaRepository(),
33
+ ).setArguments(new Map([['value', [-1, -2, -3, -5, -3]]]));
36
34
 
37
35
  expect((await min.execute(fep)).allResults()[0].getResult().get('value')).toBe(-5);
38
- })
36
+ });
@@ -0,0 +1,55 @@
1
+ import { BooleanConvertor } from '../../../../../src/engine/json/schema/convertor/BooleanConvertor';
2
+ import { Schema } from '../../../../../src';
3
+ import { ConversionMode } from '../../../../../src/engine/json/schema/convertor/enums/ConversionMode';
4
+ import { SchemaConversionException } from '../../../../../src/engine/json/schema/convertor/exception/SchemaConversionException';
5
+
6
+ const convertElement = (element: any, mode: ConversionMode) => {
7
+ return BooleanConvertor.convert([], new Schema(), mode, element);
8
+ };
9
+
10
+ test('Boolean convert null element (strict mode)', async () => {
11
+ expect(() => convertElement(null, ConversionMode.STRICT)).toThrow(SchemaConversionException);
12
+ });
13
+
14
+ test('Boolean convert true string (strict mode)', async () => {
15
+ const result = convertElement('true', ConversionMode.STRICT);
16
+ expect(result).toEqual(true);
17
+ });
18
+
19
+ test('Boolean convert false string (strict mode)', async () => {
20
+ const result = convertElement('false', ConversionMode.STRICT);
21
+ expect(result).toEqual(false);
22
+ });
23
+
24
+ test('Boolean convert one as number (strict mode)', async () => {
25
+ const result = convertElement(1, ConversionMode.STRICT);
26
+ expect(result).toEqual(true);
27
+ });
28
+
29
+ test('Boolean convert zero as number (strict mode)', async () => {
30
+ const result = convertElement(0, ConversionMode.STRICT);
31
+ expect(result).toEqual(false);
32
+ });
33
+
34
+ test('Boolean convert invalid string (strict mode)', async () => {
35
+ const invalid = 'invalid';
36
+ expect(() => convertElement(invalid, ConversionMode.STRICT)).toThrow(SchemaConversionException);
37
+ });
38
+
39
+ test('Boolean convert invalid string (lenient mode)', async () => {
40
+ const result = convertElement('invalid', ConversionMode.LENIENT);
41
+ expect(result).toEqual(null); // Assuming lenient mode returns null for invalid input
42
+ });
43
+
44
+ test('Boolean convert use default mode', async () => {
45
+ const defaultValue = true;
46
+ const schema = new Schema().setDefaultValue(defaultValue);
47
+ const result = BooleanConvertor.convert([], schema, ConversionMode.USE_DEFAULT, 'invalid');
48
+ expect(result).toEqual(defaultValue);
49
+ });
50
+
51
+ test('Boolean convert skip mode', async () => {
52
+ const element = 'invalid';
53
+ const result = convertElement(element, ConversionMode.SKIP);
54
+ expect(result).toEqual(element);
55
+ });
@@ -0,0 +1,47 @@
1
+ import { ConversionMode } from '../../../../../src/engine/json/schema/convertor/enums/ConversionMode';
2
+ import { Schema } from '../../../../../src';
3
+ import { NullConvertor } from '../../../../../src/engine/json/schema/convertor/NullConvertor';
4
+ import { SchemaConversionException } from '../../../../../src/engine/json/schema/convertor/exception/SchemaConversionException';
5
+
6
+ const convertElement = (mode: ConversionMode, element: any) => {
7
+ return NullConvertor.convert([], new Schema(), mode, element);
8
+ };
9
+
10
+ test('Null convert null element (strict mode)', async () => {
11
+ const result = convertElement(ConversionMode.STRICT, null);
12
+ expect(result).toBe(null);
13
+ });
14
+
15
+ test('Null convert null JSON element (strict mode)', async () => {
16
+ const result = convertElement(ConversionMode.STRICT, null);
17
+ expect(result).toBe(null);
18
+ });
19
+
20
+ test('Null convert string "null" (strict mode)', async () => {
21
+ const element = 'null';
22
+ const result = convertElement(ConversionMode.STRICT, element);
23
+ expect(result).toBe(null);
24
+ });
25
+
26
+ test('Null convert invalid element (strict mode)', async () => {
27
+ const element = 'invalid';
28
+ expect(() => convertElement(ConversionMode.STRICT, element)).toThrow(SchemaConversionException);
29
+ });
30
+
31
+ test('Null convert invalid element (lenient mode)', async () => {
32
+ const element = 'invalid';
33
+ const result = convertElement(ConversionMode.LENIENT, element);
34
+ expect(result).toBe(null);
35
+ });
36
+
37
+ test('Null convert use default mode', async () => {
38
+ const element = 'invalid';
39
+ const result = convertElement(ConversionMode.USE_DEFAULT, element);
40
+ expect(result).toBe(null);
41
+ });
42
+
43
+ test('Null convert skip mode', async () => {
44
+ const element = 'invalid';
45
+ const result = convertElement(ConversionMode.SKIP, element);
46
+ expect(result).toBe(element);
47
+ });
@@ -0,0 +1,154 @@
1
+ import { NumberConvertor } from '../../../../../src/engine/json/schema/convertor/NumberConvertor';
2
+ import { Schema, SchemaType } from '../../../../../src';
3
+ import { ConversionMode } from '../../../../../src/engine/json/schema/convertor/enums/ConversionMode';
4
+ import { SchemaConversionException } from '../../../../../src/engine/json/schema/convertor/exception/SchemaConversionException';
5
+
6
+ const convertElement = (schemaType: SchemaType, mode: ConversionMode, element: any) => {
7
+ return NumberConvertor.convert([], schemaType, new Schema(), mode, element);
8
+ };
9
+
10
+ const convertElementWithSchema = (
11
+ schemaType: SchemaType,
12
+ schema: Schema,
13
+ mode: ConversionMode,
14
+ element: any,
15
+ ) => {
16
+ return NumberConvertor.convert([], schemaType, schema, mode, element);
17
+ };
18
+
19
+ test('Convert null element (strict mode)', async () => {
20
+ expect(() => convertElement(SchemaType.INTEGER, ConversionMode.STRICT, null)).toThrow(
21
+ SchemaConversionException,
22
+ );
23
+ });
24
+
25
+ test('Convert non-number element (strict mode)', async () => {
26
+ const nonNumber = 'not a number';
27
+ expect(() => convertElement(SchemaType.INTEGER, ConversionMode.STRICT, nonNumber)).toThrow(
28
+ SchemaConversionException,
29
+ );
30
+ });
31
+
32
+ test('Convert valid integer (strict mode)', async () => {
33
+ const result = convertElement(SchemaType.INTEGER, ConversionMode.STRICT, 42);
34
+ expect(result).toBe(42);
35
+ });
36
+
37
+ test('Convert valid long (strict mode)', async () => {
38
+ const result = convertElement(SchemaType.LONG, ConversionMode.STRICT, 42);
39
+ expect(result).toBe(42);
40
+ });
41
+
42
+ test('Convert valid double (strict mode)', async () => {
43
+ const result = convertElement(SchemaType.DOUBLE, ConversionMode.STRICT, 42.0);
44
+ expect(result).toBe(42.0);
45
+ });
46
+
47
+ test('Convert valid float (strict mode)', async () => {
48
+ const result = convertElement(SchemaType.FLOAT, ConversionMode.STRICT, 42.0);
49
+ expect(result).toBe(42.0);
50
+ });
51
+
52
+ test('Convert invalid integer (strict mode)', async () => {
53
+ const invalidInteger = 42.1;
54
+ expect(() => convertElement(SchemaType.INTEGER, ConversionMode.STRICT, invalidInteger)).toThrow(
55
+ SchemaConversionException,
56
+ );
57
+ });
58
+
59
+ test('Convert invalid long (strict mode)', async () => {
60
+ const invalidLong = 2312.451;
61
+ expect(() => convertElement(SchemaType.LONG, ConversionMode.STRICT, invalidLong)).toThrow(
62
+ SchemaConversionException,
63
+ );
64
+ });
65
+
66
+ test('Convert integer use default mode', async () => {
67
+ const result = convertElementWithSchema(
68
+ SchemaType.INTEGER,
69
+ new Schema(),
70
+ ConversionMode.USE_DEFAULT,
71
+ 42,
72
+ );
73
+ expect(result).toBe(42);
74
+ });
75
+
76
+ test('Convert integer skip mode', async () => {
77
+ const result = convertElementWithSchema(
78
+ SchemaType.INTEGER,
79
+ new Schema(),
80
+ ConversionMode.SKIP,
81
+ null,
82
+ );
83
+ expect(result).toBe(null);
84
+ });
85
+
86
+ test('Convert integer lenient mode', async () => {
87
+ const result = convertElementWithSchema(
88
+ SchemaType.INTEGER,
89
+ new Schema(),
90
+ ConversionMode.LENIENT,
91
+ '42',
92
+ );
93
+ expect(result).toBe(42);
94
+ });
95
+
96
+ test('Convert long use default mode', async () => {
97
+ const result = convertElementWithSchema(
98
+ SchemaType.LONG,
99
+ new Schema(),
100
+ ConversionMode.USE_DEFAULT,
101
+ 42,
102
+ );
103
+ expect(result).toBe(42);
104
+ });
105
+
106
+ test('Convert long skip mode', async () => {
107
+ const result = convertElementWithSchema(
108
+ SchemaType.LONG,
109
+ new Schema(),
110
+ ConversionMode.SKIP,
111
+ null,
112
+ );
113
+ expect(result).toBe(null);
114
+ });
115
+
116
+ test('Convert long lenient mode', async () => {
117
+ const result = convertElementWithSchema(
118
+ SchemaType.LONG,
119
+ new Schema(),
120
+ ConversionMode.LENIENT,
121
+ '42',
122
+ );
123
+ expect(result).toBe(42);
124
+ });
125
+
126
+ test('Convert float use default mode', async () => {
127
+ const result = convertElementWithSchema(
128
+ SchemaType.FLOAT,
129
+ new Schema(),
130
+ ConversionMode.USE_DEFAULT,
131
+ 42.0,
132
+ );
133
+ expect(result).toBe(42.0);
134
+ });
135
+
136
+ test('Convert float skip mode', async () => {
137
+ const result = convertElementWithSchema(
138
+ SchemaType.FLOAT,
139
+ new Schema(),
140
+ ConversionMode.SKIP,
141
+ null,
142
+ );
143
+ expect(result).toBe(null);
144
+ });
145
+
146
+ test('Convert float lenient mode', async () => {
147
+ const result = convertElementWithSchema(
148
+ SchemaType.FLOAT,
149
+ new Schema(),
150
+ ConversionMode.LENIENT,
151
+ '42.0',
152
+ );
153
+ expect(result).toBe(42.0);
154
+ });
@@ -0,0 +1,56 @@
1
+ import { StringConvertor } from '../../../../../src/engine/json/schema/convertor/StringConvertor';
2
+ import { Schema } from '../../../../../src';
3
+ import { ConversionMode } from '../../../../../src/engine/json/schema/convertor/enums/ConversionMode';
4
+ import { SchemaConversionException } from '../../../../../src/engine/json/schema/convertor/exception/SchemaConversionException';
5
+
6
+ const convertElement = (schema: Schema, mode: ConversionMode, element: any) => {
7
+ return StringConvertor.convert([], schema, mode, element);
8
+ };
9
+
10
+ test('Convert valid string (strict mode)', async () => {
11
+ const schema = new Schema();
12
+ const element = 'test string';
13
+ const result = convertElement(schema, ConversionMode.STRICT, element);
14
+ expect(result).toBe('test string');
15
+ });
16
+
17
+ test('Convert null element (strict mode)', async () => {
18
+ const schema = new Schema();
19
+ expect(() => convertElement(schema, ConversionMode.STRICT, null)).toThrow(
20
+ SchemaConversionException,
21
+ );
22
+ });
23
+
24
+ test('Convert null object (strict mode)', async () => {
25
+ const schema = new Schema();
26
+ expect(() => convertElement(schema, ConversionMode.STRICT, null)).toThrow(
27
+ SchemaConversionException,
28
+ );
29
+ });
30
+
31
+ test('Convert empty element (strict mode)', async () => {
32
+ const schema = new Schema();
33
+ const element = '';
34
+ const result = convertElement(schema, ConversionMode.STRICT, element);
35
+ expect(result).toBe('');
36
+ });
37
+
38
+ test('Convert non-primitive element (strict mode)', async () => {
39
+ const schema = new Schema();
40
+ const element = 123;
41
+ const result = convertElement(schema, ConversionMode.STRICT, element);
42
+ expect(result).toBe('123');
43
+ });
44
+
45
+ test('Convert use default mode', async () => {
46
+ const schema = new Schema();
47
+ schema.setDefaultValue('default value');
48
+ const result = convertElement(schema, ConversionMode.USE_DEFAULT, null);
49
+ expect(result).toBe('default value');
50
+ });
51
+
52
+ test('Convert skip mode', async () => {
53
+ const schema = new Schema();
54
+ const result = convertElement(schema, ConversionMode.SKIP, null);
55
+ expect(result).toBe(null);
56
+ });
@@ -9,15 +9,15 @@ const repo = new KIRunSchemaRepository();
9
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
- expect(AnyOfAllOfOneOfValidator.validate([], schema, repo, 10)).toBe(10);
12
+ expect(await AnyOfAllOfOneOfValidator.validate([], schema, repo, 10)).toBe(10);
13
13
  });
14
14
 
15
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([
19
- 1, 2, 3,
20
- ]);
18
+ expect(await AnyOfAllOfOneOfValidator.validate([], arraySchema, repo, [1, 2, 3])).toStrictEqual(
19
+ [1, 2, 3],
20
+ );
21
21
  });
22
22
 
23
23
  test('Any Of All Of One Validator Test 3', async () => {
@@ -25,7 +25,9 @@ test('Any Of All Of One Validator Test 3', async () => {
25
25
  new Map<string, Schema>([['key', Schema.ofString('key')]]),
26
26
  );
27
27
 
28
- expect(AnyOfAllOfOneOfValidator.validate([], objSchema, repo, { key: 'value' })).toStrictEqual({
28
+ expect(
29
+ await AnyOfAllOfOneOfValidator.validate([], objSchema, repo, { key: 'value' }),
30
+ ).toStrictEqual({
29
31
  key: 'value',
30
32
  });
31
33
  });
@@ -33,11 +35,11 @@ test('Any Of All Of One Validator Test 3', async () => {
33
35
  test('Any Of All Of One Validator Test 3', async () => {
34
36
  let nullSchema: Schema = new Schema().setType(TypeUtil.of(SchemaType.NULL));
35
37
 
36
- expect(AnyOfAllOfOneOfValidator.validate([], nullSchema, repo, null)).toBe(null);
38
+ expect(await AnyOfAllOfOneOfValidator.validate([], nullSchema, repo, null)).toBe(null);
37
39
  });
38
40
 
39
41
  test('Any Of All Of One Validator Test 3', async () => {
40
42
  let nullSchema: Schema = new Schema().setType(TypeUtil.of(SchemaType.BOOLEAN));
41
43
 
42
- expect(AnyOfAllOfOneOfValidator.validate([], nullSchema, repo, null)).toBe(null);
44
+ expect(await AnyOfAllOfOneOfValidator.validate([], nullSchema, repo, null)).toBe(null);
43
45
  });
@@ -27,13 +27,13 @@ test('NotValidation', async () => {
27
27
  .setDefaultValue(1)
28
28
  .setNot(Schema.of('Not Integer', SchemaType.INTEGER));
29
29
 
30
- expect(SchemaValidator.validate(undefined, sch, undefined, 0)).rejects.toThrow();
30
+ await expect(SchemaValidator.validate(undefined, sch, undefined, 0)).rejects.toThrow();
31
31
 
32
32
  sch = Schema.of('Not Schema', SchemaType.INTEGER, SchemaType.LONG, SchemaType.FLOAT)
33
33
  .setDefaultValue(1)
34
34
  .setNot(new Schema().setConstant(0));
35
35
 
36
- expect(SchemaValidator.validate(undefined, sch, undefined, 0)).rejects.toThrow();
36
+ await expect(SchemaValidator.validate(undefined, sch, undefined, 0)).rejects.toThrow();
37
37
  expect(await SchemaValidator.validate(undefined, sch, undefined, null)).toBe(1);
38
38
  expect(await SchemaValidator.validate(undefined, sch, undefined, 2)).toBe(2);
39
39
  });
@@ -44,5 +44,5 @@ test('constantValidation', async () => {
44
44
  const value = await SchemaValidator.validate(undefined, sch, undefined, 1);
45
45
  expect(value).toBe(1);
46
46
 
47
- expect(SchemaValidator.validate(undefined, sch, undefined, 0)).rejects.toThrow();
47
+ await expect(SchemaValidator.validate(undefined, sch, undefined, 0)).rejects.toThrow();
48
48
  });
@@ -1,14 +1,6 @@
1
- import {
2
- KIRunSchemaRepository,
3
- Schema,
4
- SchemaType,
5
- StringFormat,
6
- TypeUtil,
7
- } from '../../../../../src';
1
+ import { Schema, SchemaType, StringFormat, TypeUtil } from '../../../../../src';
8
2
  import { StringValidator } from '../../../../../src';
9
3
 
10
- const repo = new KIRunSchemaRepository();
11
-
12
4
  test('String valid case', async () => {
13
5
  let value: String = 'surendhar';
14
6
  let schema: Schema = new Schema().setType(TypeUtil.of(SchemaType.STRING));