@cleverbrush/schema 1.0.0-beta.5 → 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 (76) hide show
  1. package/README.md +118 -320
  2. package/dist/builders/AnySchemaBuilder.d.ts +76 -0
  3. package/dist/builders/AnySchemaBuilder.js +112 -0
  4. package/dist/builders/ArraySchemaBuilder.d.ts +112 -14
  5. package/dist/builders/ArraySchemaBuilder.js +254 -111
  6. package/dist/builders/BooleanSchemaBuilder.d.ts +69 -29
  7. package/dist/builders/BooleanSchemaBuilder.js +134 -74
  8. package/dist/builders/DateSchemaBuilder.d.ts +179 -0
  9. package/dist/builders/DateSchemaBuilder.js +433 -0
  10. package/dist/builders/FunctionSchemaBuilder.d.ts +59 -25
  11. package/dist/builders/FunctionSchemaBuilder.js +102 -58
  12. package/dist/builders/NumberSchemaBuilder.d.ts +159 -59
  13. package/dist/builders/NumberSchemaBuilder.js +345 -165
  14. package/dist/builders/ObjectSchemaBuilder.d.ts +310 -81
  15. package/dist/builders/ObjectSchemaBuilder.js +528 -283
  16. package/dist/builders/SchemaBuilder.d.ts +157 -34
  17. package/dist/builders/SchemaBuilder.js +258 -71
  18. package/dist/builders/StringSchemaBuilder.d.ts +138 -13
  19. package/dist/builders/StringSchemaBuilder.js +261 -115
  20. package/dist/builders/UnionSchemaBuilder.d.ts +132 -9
  21. package/dist/builders/UnionSchemaBuilder.js +196 -75
  22. package/dist/index.d.ts +20 -40
  23. package/dist/index.js +19 -32
  24. package/dist/utils/transaction.d.ts +46 -0
  25. package/dist/utils/transaction.js +178 -0
  26. package/package.json +27 -14
  27. package/dist/defaultSchemas.d.ts +0 -4
  28. package/dist/defaultSchemas.js +0 -45
  29. package/dist/schema.d.ts +0 -231
  30. package/dist/schema.js +0 -2
  31. package/dist/schemaRegistry.d.ts +0 -49
  32. package/dist/schemaRegistry.js +0 -278
  33. package/dist/validators/validateArray.d.ts +0 -3
  34. package/dist/validators/validateArray.js +0 -60
  35. package/dist/validators/validateBoolean.d.ts +0 -2
  36. package/dist/validators/validateBoolean.js +0 -30
  37. package/dist/validators/validateFunction.d.ts +0 -2
  38. package/dist/validators/validateFunction.js +0 -21
  39. package/dist/validators/validateNumber.d.ts +0 -2
  40. package/dist/validators/validateNumber.js +0 -69
  41. package/dist/validators/validateObject.d.ts +0 -3
  42. package/dist/validators/validateObject.js +0 -95
  43. package/dist/validators/validateString.d.ts +0 -2
  44. package/dist/validators/validateString.js +0 -50
  45. package/dist/validators/validateUnion.d.ts +0 -3
  46. package/dist/validators/validateUnion.js +0 -30
  47. package/src/builders/ArraySchemaBuilder.test.ts +0 -270
  48. package/src/builders/ArraySchemaBuilder.ts +0 -381
  49. package/src/builders/BooleanSchemaBuilder.test.ts +0 -196
  50. package/src/builders/BooleanSchemaBuilder.ts +0 -155
  51. package/src/builders/FunctionSchemaBuilder.test.ts +0 -145
  52. package/src/builders/FunctionSchemaBuilder.ts +0 -117
  53. package/src/builders/NumberSchemaBuilder.test.ts +0 -493
  54. package/src/builders/NumberSchemaBuilder.ts +0 -789
  55. package/src/builders/ObjectSchemaBuilder.test.ts +0 -657
  56. package/src/builders/ObjectSchemaBuilder.ts +0 -794
  57. package/src/builders/SchemaBuilder.test.ts +0 -73
  58. package/src/builders/SchemaBuilder.ts +0 -135
  59. package/src/builders/StringSchemaBuilder.test.ts +0 -318
  60. package/src/builders/StringSchemaBuilder.ts +0 -392
  61. package/src/builders/UnionSchemaBuilder.test.ts +0 -162
  62. package/src/builders/UnionSchemaBuilder.ts +0 -154
  63. package/src/defaultSchemas.ts +0 -44
  64. package/src/index.ts +0 -66
  65. package/src/schema.ts +0 -849
  66. package/src/schemaRegistry.builders.test.ts +0 -1393
  67. package/src/schemaRegistry.test.ts +0 -118
  68. package/src/schemaRegistry.ts +0 -461
  69. package/src/validators/validateArray.ts +0 -76
  70. package/src/validators/validateBoolean.ts +0 -36
  71. package/src/validators/validateFunction.ts +0 -25
  72. package/src/validators/validateNumber.ts +0 -82
  73. package/src/validators/validateObject.ts +0 -119
  74. package/src/validators/validateString.ts +0 -59
  75. package/src/validators/validateUnion.ts +0 -36
  76. package/tsconfig.json +0 -16
@@ -1,73 +0,0 @@
1
- import { number } from './NumberSchemaBuilder.js';
2
-
3
- test('Validators - 1', () => {
4
- const schema = number();
5
- expect(schema).not.toHaveProperty('validators');
6
- });
7
-
8
- test('Validators - 2', () => {
9
- const schema = number().addValidator(() => ({ valid: true }));
10
- expect(schema).toHaveProperty('validators');
11
- expect(schema.validators).toHaveProperty('length', 1);
12
- });
13
-
14
- test('Validators - 3', () => {
15
- const schema = number()
16
- .addValidator(() => ({ valid: true }))
17
- .addValidator(() => ({ valid: false }));
18
- expect(schema).toHaveProperty('validators');
19
- expect(schema.validators).toHaveProperty('length', 2);
20
- });
21
-
22
- test('Validators - 4', () => {
23
- const schema = number()
24
- .addValidator(() => ({ valid: true }))
25
- .clearValidators();
26
- expect(schema).not.toHaveProperty('validators');
27
- });
28
-
29
- test('Validators - 5', () => {
30
- expect(() => {
31
- number().addValidator('string' as any);
32
- }).toThrow();
33
- });
34
-
35
- test('Preprocessor - 1', () => {
36
- const schema = number();
37
- expect(schema).not.toHaveProperty('preprocessor');
38
- });
39
-
40
- test('Preprocessor - 2', () => {
41
- const schema = number().addPreprocessor(() => new Date());
42
- expect(schema).toHaveProperty('preprocessor');
43
- });
44
-
45
- test('Preprocessor - 3', () => {
46
- const schema = number()
47
- .addPreprocessor(() => new Date())
48
- .clearPreprocessor();
49
- expect(schema).not.toHaveProperty('preprocessor');
50
- });
51
-
52
- test('Preprocessor - 4', () => {
53
- const schema1 = number();
54
- const schema2 = schema1.addPreprocessor(() => new Date());
55
- const equal = (schema1 as any) === schema2;
56
- expect(equal).toEqual(false);
57
- });
58
-
59
- test('Preprocessor - 5', () => {
60
- const schema1 = number().addPreprocessor(() => new Date());
61
- const schema2 = schema1.clearPreprocessor();
62
- const equal = (schema1 as any) === schema2;
63
- expect(equal).toEqual(false);
64
- });
65
-
66
- test('Preprocessor - 6', () => {
67
- const schema1 = number()
68
- .addPreprocessor(() => new Date())
69
- .min(30);
70
- const schema2 = schema1.clearPreprocessor();
71
- const equal = (schema1 as any) === schema2;
72
- expect(equal).toEqual(false);
73
- });
@@ -1,135 +0,0 @@
1
- import { Schema, Validator } from '../schema.js';
2
-
3
- export interface ISchemaBuilder<
4
- TRequired extends boolean = true,
5
- TNullable extends boolean = false
6
- > {
7
- readonly _schema: Schema;
8
- isRequired: TRequired;
9
- isNullable: TNullable;
10
- validators?: Validator[];
11
- preprocessor?: ((value: unknown) => unknown | Promise<unknown>) | string;
12
- addValidator(validator: Validator): this;
13
- clearValidators(): this;
14
- addPreprocessor(
15
- preprocessor: ((value: unknown) => unknown | Promise<unknown>) | string
16
- ): this;
17
- clearPreprocessor(): this;
18
- clone(): this;
19
- }
20
-
21
- export abstract class SchemaBuilder<
22
- TRequired extends boolean = true,
23
- TNullable extends boolean = false
24
- > implements ISchemaBuilder<TRequired, TNullable>
25
- {
26
- protected _isRequired: TRequired = true as any as TRequired;
27
- protected _isNullable: TNullable = false as any as TNullable;
28
-
29
- public validators?: Validator[];
30
-
31
- public preprocessor?:
32
- | ((value: unknown) => unknown | Promise<unknown>)
33
- | string;
34
-
35
- public abstract clone(): this;
36
-
37
- public abstract get _schema(): Schema;
38
-
39
- protected constructor(obj: {
40
- isRequired?: boolean;
41
- isNullable?: boolean;
42
- preprocessor?:
43
- | ((value: unknown) => unknown | Promise<unknown>)
44
- | string;
45
- validators?: Validator[];
46
- }) {
47
- if (typeof obj === 'object') {
48
- if (typeof obj.isRequired !== 'undefined') {
49
- this.isRequired = obj.isRequired;
50
- }
51
- if (typeof obj.isNullable !== 'undefined') {
52
- this.isNullable = obj.isNullable;
53
- }
54
- if (Array.isArray(obj.validators)) {
55
- this.validators = [...obj.validators];
56
- }
57
- if (typeof obj.preprocessor !== 'undefined') {
58
- this.preprocessor = obj.preprocessor;
59
- }
60
- }
61
- }
62
-
63
- protected getCommonSchema() {
64
- const schemas = [];
65
- if (typeof this.preprocessor !== 'undefined') {
66
- schemas.push({
67
- preprocessor: this.preprocessor
68
- });
69
- }
70
- if (typeof this.isRequired !== 'undefined') {
71
- schemas.push({ isRequired: this.isRequired });
72
- }
73
- if (typeof this.isNullable !== 'undefined') {
74
- schemas.push({ isNullable: this.isNullable });
75
- }
76
- if (typeof this.validators !== 'undefined') {
77
- schemas.push({ validators: [...this.validators] });
78
- }
79
- return Object.assign({}, ...schemas);
80
- }
81
-
82
- addPreprocessor(
83
- preprocessor: ((value: unknown) => unknown | Promise<unknown>) | string
84
- ) {
85
- const result = this.clone();
86
- result.preprocessor = preprocessor;
87
- return result;
88
- }
89
-
90
- clearPreprocessor(): this {
91
- if (typeof this.preprocessor === 'undefined') {
92
- return this;
93
- }
94
-
95
- const result = this.clone();
96
- delete result.preprocessor;
97
- return result;
98
- }
99
-
100
- addValidator(validator: Validator): this {
101
- const result = this.clone();
102
- if (typeof validator !== 'function')
103
- throw new Error('validator should be a function');
104
-
105
- if (Array.isArray(result.validators)) {
106
- result.validators.push(validator);
107
- } else {
108
- result.validators = [validator];
109
- }
110
- return result;
111
- }
112
-
113
- clearValidators(): this {
114
- if (typeof this.validators === 'undefined') return this;
115
- const result = this.clone();
116
- delete result.validators;
117
- return result;
118
- }
119
-
120
- public get isRequired(): TRequired {
121
- return this._isRequired;
122
- }
123
-
124
- protected set isRequired(val: boolean) {
125
- this._isRequired = val as TRequired;
126
- }
127
-
128
- public get isNullable(): TNullable {
129
- return this._isNullable;
130
- }
131
-
132
- protected set isNullable(val: boolean) {
133
- this._isNullable = val as TNullable;
134
- }
135
- }
@@ -1,318 +0,0 @@
1
- import { deepEqual } from '@cleverbrush/deep';
2
-
3
- import { Schema } from '../schema.js';
4
- import { string } from './StringSchemaBuilder.js';
5
-
6
- test('Clean', () => {
7
- const schema = string();
8
- expect(schema).toHaveProperty('type', 'string');
9
- expect(schema).toHaveProperty('isRequired', true);
10
- expect(schema).toHaveProperty('isNullable', false);
11
- });
12
-
13
- test('optional', () => {
14
- const schema = string().optional();
15
- expect(schema).toHaveProperty('type', 'string');
16
- expect(schema).toHaveProperty('isRequired', false);
17
- });
18
-
19
- test('optional - 2', () => {
20
- const schema = string().optional().required();
21
- expect(schema).toHaveProperty('type', 'string');
22
- expect(schema).toHaveProperty('isRequired', true);
23
- });
24
-
25
- test('optional - 3', () => {
26
- const schema1 = string();
27
- const schema2 = schema1.optional();
28
- const e = (schema1 as Schema) === (schema2 as Schema);
29
- const isRequiredEqual = (schema1 as any).isRequired !== schema2.isRequired;
30
- expect(e).toEqual(false);
31
- expect(isRequiredEqual).toEqual(true);
32
- });
33
-
34
- test('optional - 4', () => {
35
- const schema1 = string().optional();
36
- const schema2 = schema1.optional();
37
- const e = (schema1 as Schema) === (schema2 as Schema);
38
- const isRequiredEqual = (schema1 as any).isRequired === schema2.isRequired;
39
- expect(e).toEqual(true);
40
- expect(isRequiredEqual).toEqual(true);
41
- });
42
-
43
- test('optional - 5', () => {
44
- const schema1 = string();
45
- const schema2 = schema1.required();
46
- const e = (schema1 as Schema) === (schema2 as Schema);
47
- const isRequiredEqual = (schema1 as any).isRequired === schema2.isRequired;
48
- expect(e).toEqual(true);
49
- expect(isRequiredEqual).toEqual(true);
50
- });
51
-
52
- test('optional - 6', () => {
53
- const schema1 = string().optional();
54
- const schema2 = schema1.required();
55
- const e = (schema1 as Schema) === (schema2 as Schema);
56
- const isRequiredEqual = (schema1 as any).isRequired === schema2.isRequired;
57
- expect(e).toEqual(false);
58
- expect(isRequiredEqual).toEqual(false);
59
- });
60
-
61
- test('optional - 7', () => {
62
- const schema1 = string().optional().required();
63
- const schema2 = schema1.required();
64
- const e = (schema1 as Schema) === (schema2 as Schema);
65
- const isRequiredEqual = (schema1 as any).isRequired === schema2.isRequired;
66
- expect(e).toEqual(true);
67
- expect(isRequiredEqual).toEqual(true);
68
- });
69
-
70
- test('nullable - 1', () => {
71
- const schema = string().nullable();
72
- expect(schema).toHaveProperty('type', 'string');
73
- expect(schema).toHaveProperty('isNullable', true);
74
- });
75
-
76
- test('nullable - 2', () => {
77
- const schema = string().nullable().notNullable();
78
- expect(schema).toHaveProperty('type', 'string');
79
- expect(schema).toHaveProperty('isNullable', false);
80
- });
81
-
82
- test('nullable - 3', () => {
83
- const schema1 = string();
84
- const schema2 = schema1.nullable();
85
- const e = (schema1 as Schema) === (schema2 as Schema);
86
- const isNullableEqual = (schema1 as any).isNullable !== schema2.isNullable;
87
- expect(e).toEqual(false);
88
- expect(isNullableEqual).toEqual(true);
89
- });
90
-
91
- test('nullable - 4', () => {
92
- const schema1 = string().nullable();
93
- const schema2 = schema1.nullable();
94
- const e = (schema1 as Schema) === (schema2 as Schema);
95
- const isNullableEqual = (schema1 as any).isNullable === schema2.isNullable;
96
- expect(e).toEqual(true);
97
- expect(isNullableEqual).toEqual(true);
98
- });
99
-
100
- test('nullable - 5', () => {
101
- const schema1 = string();
102
- const schema2 = schema1.nullable();
103
- const e = (schema1 as Schema) === (schema2 as Schema);
104
- const isNullableEqual = (schema1 as any).isNullable === schema2.isNullable;
105
- expect(e).toEqual(false);
106
- expect(isNullableEqual).toEqual(false);
107
- });
108
-
109
- test('nullable - 6', () => {
110
- const schema1 = string();
111
- const schema2 = schema1.notNullable();
112
- const e = (schema1 as Schema) === (schema2 as Schema);
113
- const isNullableEqual = (schema1 as any).isNullable === schema2.isNullable;
114
- expect(e).toEqual(true);
115
- expect(isNullableEqual).toEqual(true);
116
- });
117
-
118
- test('nullable - 7', () => {
119
- const schema1 = string().nullable();
120
- const schema2 = schema1.notNullable();
121
- const e = (schema1 as Schema) === (schema2 as Schema);
122
- const isNullableEqual = (schema1 as any).isNullable === schema2.isNullable;
123
- expect(e).toEqual(false);
124
- expect(isNullableEqual).toEqual(false);
125
- });
126
-
127
- test('equals - 1', () => {
128
- const schema = string().equals('abc');
129
- expect(schema._schema).toHaveProperty('type', 'string');
130
- expect(schema._schema).toHaveProperty('equals', 'abc');
131
- });
132
-
133
- test('equals - 2', () => {
134
- const schema = string();
135
- expect(schema._schema).toHaveProperty('type', 'string');
136
- expect(schema._schema).not.toHaveProperty('equals');
137
- });
138
-
139
- test('equals - 4', () => {
140
- const schema = string().equals('abcd').clearEquals();
141
- expect(schema._schema).toHaveProperty('type', 'string');
142
- expect(schema._schema).not.toHaveProperty('equals');
143
- });
144
-
145
- test('equals - 5', () => {
146
- const schema1 = string();
147
- const schema2 = schema1.equals('abcde');
148
- const equals = schema1._schema.equals === schema2._schema.equals;
149
- expect(equals).toEqual(false);
150
- expect(schema1._schema).not.toHaveProperty('equals');
151
- expect(schema2._schema).toHaveProperty('equals', 'abcde');
152
- });
153
-
154
- test('equals - 6', () => {
155
- const schema1 = string().equals('abcdef');
156
- const schema2 = schema1.equals('abcdef');
157
- const equals = schema1._schema.equals === schema2._schema.equals;
158
- expect(equals).toEqual(true);
159
- expect(schema1._schema).toHaveProperty('equals', 'abcdef');
160
- expect(schema2._schema).toHaveProperty('equals', 'abcdef');
161
- });
162
-
163
- test('equals - 6', () => {
164
- const schema1 = string().equals('abcdefg');
165
- const schema2 = schema1.clearEquals();
166
- const equals = schema1._schema.equals === schema2._schema.equals;
167
- expect(equals).toEqual(false);
168
- expect(schema1._schema).toHaveProperty('equals', 'abcdefg');
169
- expect(schema2._schema).not.toHaveProperty('equals');
170
- });
171
-
172
- test('equals - 7', () => {
173
- const schema1 = string().equals('abcdefgh').clearEquals();
174
- const schema2 = schema1.clearEquals();
175
- const equals = (schema1 as any) === schema2;
176
- expect(equals).toEqual(true);
177
- });
178
-
179
- test('minLength - 1', () => {
180
- const schema = string();
181
- expect(schema._schema).not.toHaveProperty('minLength');
182
- });
183
-
184
- test('minLength - 2', () => {
185
- const schema = string().minLength(20);
186
- expect(schema._schema).toHaveProperty('minLength', 20);
187
- });
188
-
189
- test('minLength - 3', () => {
190
- const schema = string().minLength(20).clearMinLength();
191
- expect(schema._schema).not.toHaveProperty('minLength');
192
- });
193
-
194
- test('minLength - 4', () => {
195
- const schema1 = string();
196
- const schema2 = schema1.minLength(20);
197
- const equal = (schema1 as any) === schema2;
198
- expect(equal).toEqual(false);
199
- expect(schema1._schema).not.toHaveProperty('minLength');
200
- expect(schema2._schema).toHaveProperty('minLength', 20);
201
- });
202
-
203
- test('minLength - 5', () => {
204
- const schema1 = string().minLength(20);
205
- const schema2 = schema1.minLength(20);
206
- const equal = (schema1 as any) === schema2;
207
- expect(equal).toEqual(true);
208
- expect(schema1._schema).toHaveProperty('minLength', 20);
209
- expect(schema2._schema).toHaveProperty('minLength', 20);
210
- });
211
-
212
- test('minLength - 6', () => {
213
- const schema1 = string().minLength(20);
214
- const schema2 = schema1.clearMinLength();
215
- const equal = (schema1 as any) === schema2;
216
- expect(equal).toEqual(false);
217
- expect(schema1._schema).toHaveProperty('minLength', 20);
218
- expect(schema2._schema).not.toHaveProperty('minLength');
219
- });
220
-
221
- test('minLength - 7', () => {
222
- const schema1 = string();
223
- const schema2 = schema1.clearMinLength();
224
- const equal = (schema1 as any) === schema2;
225
- expect(equal).toEqual(true);
226
- expect(schema1._schema).not.toHaveProperty('minLength');
227
- expect(schema2._schema).not.toHaveProperty('minLength');
228
- });
229
-
230
- test('minLength - 8', () => {
231
- const schema1 = string().clearMinLength();
232
- const schema2 = schema1.clearMinLength();
233
- const equal = (schema1 as any) === schema2;
234
- expect(equal).toEqual(true);
235
- expect(schema1._schema).not.toHaveProperty('minLength');
236
- expect(schema2._schema).not.toHaveProperty('minLength');
237
- });
238
-
239
- test('maxLength - 1', () => {
240
- const schema = string();
241
- expect(schema._schema).not.toHaveProperty('maxLength');
242
- });
243
-
244
- test('maxLength - 2', () => {
245
- const schema = string().maxLength(30);
246
- expect(schema._schema).toHaveProperty('maxLength', 30);
247
- });
248
-
249
- test('maxLength - 3', () => {
250
- const schema = string().maxLength(30).clearMaxLength();
251
- expect(schema._schema).not.toHaveProperty('maxLength');
252
- });
253
-
254
- test('maxLength - 4', () => {
255
- const schema1 = string();
256
- const schema2 = schema1.maxLength(20);
257
- const equal = (schema1 as any) === schema2;
258
- expect(equal).toEqual(false);
259
- expect(schema1._schema).not.toHaveProperty('maxLength');
260
- expect(schema2._schema).toHaveProperty('maxLength', 20);
261
- });
262
-
263
- test('maxLength - 5', () => {
264
- const schema1 = string().maxLength(20);
265
- const schema2 = schema1.maxLength(20);
266
- const equal = (schema1 as any) === schema2;
267
- expect(equal).toEqual(true);
268
- expect(schema1._schema).toHaveProperty('maxLength', 20);
269
- expect(schema2._schema).toHaveProperty('maxLength', 20);
270
- });
271
-
272
- test('maxLength - 6', () => {
273
- const schema1 = string().maxLength(20);
274
- const schema2 = schema1.clearMaxLength();
275
- const equal = (schema1 as any) === schema2;
276
- expect(equal).toEqual(false);
277
- expect(schema1._schema).toHaveProperty('maxLength', 20);
278
- expect(schema2._schema).not.toHaveProperty('maxLength');
279
- });
280
-
281
- test('maxLength - 7', () => {
282
- const schema1 = string();
283
- const schema2 = schema1.clearMaxLength();
284
- const equal = (schema1 as any) === schema2;
285
- expect(equal).toEqual(true);
286
- expect(schema1._schema).not.toHaveProperty('maxLength');
287
- expect(schema2._schema).not.toHaveProperty('maxLength');
288
- });
289
-
290
- test('maxLength - 8', () => {
291
- const schema1 = string().clearMaxLength();
292
- const schema2 = schema1.clearMaxLength();
293
- const equal = (schema1 as any) === schema2;
294
- expect(equal).toEqual(true);
295
- expect(schema1._schema).not.toHaveProperty('maxLength');
296
- expect(schema2._schema).not.toHaveProperty('maxLength');
297
- });
298
-
299
- test('minLength,max - 1', () => {
300
- const schema = string().minLength(20).maxLength(30);
301
- expect(schema._schema).toHaveProperty('minLength', 20);
302
- expect(schema._schema).toHaveProperty('maxLength', 30);
303
- });
304
-
305
- test('Clone', () => {
306
- const schema1 = string()
307
- .minLength(20)
308
- .maxLength(30)
309
- .addValidator(() => ({ valid: true }));
310
- const schema2 = schema1.clone();
311
- const equal = (schema1 as any) === schema2;
312
- expect(equal).toEqual(false);
313
- const equal2 = deepEqual(
314
- (schema1 as any)._schema,
315
- (schema2 as any)._schema
316
- );
317
- expect(equal2).toEqual(true);
318
- });