@based/schema 1.0.8 → 1.0.10
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.
- package/dist/error.d.ts +2 -1
- package/dist/error.js +1 -0
- package/dist/error.js.map +1 -1
- package/dist/set/fields/index.js +2 -0
- package/dist/set/fields/index.js.map +1 -1
- package/dist/set/fields/number.js +4 -0
- package/dist/set/fields/number.js.map +1 -1
- package/dist/set/index.js +26 -0
- package/dist/set/index.js.map +1 -1
- package/dist/set/isValidId.js +1 -1
- package/dist/walker/args.d.ts +4 -0
- package/dist/walker/args.js +48 -2
- package/dist/walker/args.js.map +1 -1
- package/dist/walker/parse.js +30 -5
- package/dist/walker/parse.js.map +1 -1
- package/package.json +1 -1
- package/src/error.ts +1 -0
- package/src/set/fields/index.ts +2 -1
- package/src/set/fields/number.ts +5 -0
- package/src/set/index.ts +27 -0
- package/src/set/isValidId.ts +1 -1
- package/src/walker/args.ts +56 -2
- package/src/walker/parse.ts +37 -5
- package/test/number.ts +74 -69
- package/test/rest.ts +73 -136
- package/test/set.ts +116 -0
- package/test/string.ts +121 -139
- package/test/text.ts +199 -0
- package/test/walker.ts +185 -48
package/src/walker/parse.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { deepEqual } from '@saulx/utils'
|
|
1
2
|
import {
|
|
2
3
|
BasedSchemaField,
|
|
3
4
|
BasedSchemaFieldObject,
|
|
@@ -20,7 +21,13 @@ function createOrUseArgs<T>(
|
|
|
20
21
|
if (newArgs instanceof ArgsClass) {
|
|
21
22
|
return newArgs
|
|
22
23
|
}
|
|
23
|
-
|
|
24
|
+
|
|
25
|
+
const x = from.create(newArgs)
|
|
26
|
+
|
|
27
|
+
// x.collectedCommands = from.collectedCommands
|
|
28
|
+
// x.fromBackTrack = from.fromBackTrack
|
|
29
|
+
|
|
30
|
+
return x
|
|
24
31
|
}
|
|
25
32
|
|
|
26
33
|
async function parseKey<T>(
|
|
@@ -36,7 +43,11 @@ async function parseKey<T>(
|
|
|
36
43
|
},
|
|
37
44
|
from
|
|
38
45
|
)
|
|
46
|
+
|
|
47
|
+
// if same
|
|
48
|
+
|
|
39
49
|
const newArgs = createOrUseArgs(keyArgs, await parser(keyArgs))
|
|
50
|
+
|
|
40
51
|
if (newArgs) {
|
|
41
52
|
return newArgs.parse()
|
|
42
53
|
}
|
|
@@ -93,6 +104,7 @@ export async function parse<T>(
|
|
|
93
104
|
}
|
|
94
105
|
await Promise.all(keyQ)
|
|
95
106
|
|
|
107
|
+
// schema
|
|
96
108
|
if (args.stopped === undefined) {
|
|
97
109
|
const fieldQ: Promise<ParseResult<T>>[] = []
|
|
98
110
|
if (args.typeSchema && !args.fieldSchema) {
|
|
@@ -135,6 +147,7 @@ export async function parse<T>(
|
|
|
135
147
|
await Promise.all(fieldQ)
|
|
136
148
|
}
|
|
137
149
|
|
|
150
|
+
// any
|
|
138
151
|
if (args.stopped !== Stopped.stopAll) {
|
|
139
152
|
const parser = opts.parsers.any || opts.parsers.catch
|
|
140
153
|
if (parser) {
|
|
@@ -148,6 +161,7 @@ export async function parse<T>(
|
|
|
148
161
|
}
|
|
149
162
|
} else {
|
|
150
163
|
for (const key in args.value) {
|
|
164
|
+
// console.info(' -> parse field: ', args.path, '->', key)
|
|
151
165
|
if ((!opts.parsers.any && keysHandled.has(key)) || allKeysHandled) {
|
|
152
166
|
continue
|
|
153
167
|
}
|
|
@@ -158,6 +172,16 @@ export async function parse<T>(
|
|
|
158
172
|
}
|
|
159
173
|
}
|
|
160
174
|
|
|
175
|
+
// console.log(
|
|
176
|
+
// ' OBJECT COMPLETE ------------->',
|
|
177
|
+
// args.id,
|
|
178
|
+
// args.path,
|
|
179
|
+
// 'collected: ',
|
|
180
|
+
// args.collectedCommands,
|
|
181
|
+
// 'backtracked: ',
|
|
182
|
+
// args.fromBackTrack
|
|
183
|
+
// )
|
|
184
|
+
|
|
161
185
|
if (
|
|
162
186
|
opts.backtrack &&
|
|
163
187
|
!args.skipCollection &&
|
|
@@ -168,14 +192,16 @@ export async function parse<T>(
|
|
|
168
192
|
args.fromBackTrack ?? [],
|
|
169
193
|
args.collectedCommands ?? []
|
|
170
194
|
)
|
|
171
|
-
if (backtracked
|
|
172
|
-
|
|
173
|
-
|
|
195
|
+
if (backtracked) {
|
|
196
|
+
const target = args.getBackTrackTarget()
|
|
197
|
+
if (!target.fromBackTrack) {
|
|
198
|
+
target.fromBackTrack = []
|
|
174
199
|
}
|
|
175
|
-
|
|
200
|
+
target.fromBackTrack.push(backtracked)
|
|
176
201
|
}
|
|
177
202
|
}
|
|
178
203
|
} else {
|
|
204
|
+
// more
|
|
179
205
|
if (args.fieldSchema) {
|
|
180
206
|
const fieldParser = getFieldParser(args)
|
|
181
207
|
if (fieldParser) {
|
|
@@ -188,6 +214,12 @@ export async function parse<T>(
|
|
|
188
214
|
const anyParser = opts.parsers.any || opts.parsers.catch
|
|
189
215
|
anyParser(args)
|
|
190
216
|
}
|
|
217
|
+
} else {
|
|
218
|
+
// console.info(
|
|
219
|
+
// ' ---->',
|
|
220
|
+
// 'parse non object (no field parser skip)',
|
|
221
|
+
// args.path
|
|
222
|
+
// )
|
|
191
223
|
}
|
|
192
224
|
}
|
|
193
225
|
}
|
package/test/number.ts
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
BasedSchema,
|
|
5
5
|
BasedSchemaCollectProps,
|
|
6
6
|
BasedSetTarget,
|
|
7
|
-
|
|
7
|
+
setWalker,
|
|
8
8
|
} from '../src/index'
|
|
9
9
|
import { ParseError } from '../src/error'
|
|
10
10
|
import { resultCollect, errorCollect } from './utils'
|
|
@@ -54,22 +54,22 @@ const schema: BasedSchema = {
|
|
|
54
54
|
//todo need help typing this maybe
|
|
55
55
|
|
|
56
56
|
test('min-max', async (t) => {
|
|
57
|
-
const e1 = await
|
|
57
|
+
const e1 = await setWalker(schema, {
|
|
58
58
|
$id: 'bl1',
|
|
59
59
|
number: 1,
|
|
60
60
|
})
|
|
61
61
|
|
|
62
|
-
const e2 = await
|
|
62
|
+
const e2 = await setWalker(schema, {
|
|
63
63
|
$id: 'bl1',
|
|
64
64
|
number: 10,
|
|
65
65
|
})
|
|
66
66
|
|
|
67
|
-
const res1 = await
|
|
67
|
+
const res1 = await setWalker(schema, {
|
|
68
68
|
$id: 'bl1',
|
|
69
69
|
number: 3,
|
|
70
70
|
})
|
|
71
71
|
|
|
72
|
-
const res2 = await
|
|
72
|
+
const res2 = await setWalker(schema, {
|
|
73
73
|
$id: 'bl1',
|
|
74
74
|
number: 6,
|
|
75
75
|
})
|
|
@@ -83,22 +83,22 @@ test('min-max', async (t) => {
|
|
|
83
83
|
})
|
|
84
84
|
|
|
85
85
|
test('min-max exclusive', async (t) => {
|
|
86
|
-
const e1 = await
|
|
86
|
+
const e1 = await setWalker(schema, {
|
|
87
87
|
$id: 'bl1',
|
|
88
88
|
exclusiveminmax: 3,
|
|
89
89
|
})
|
|
90
90
|
|
|
91
|
-
const e2 = await
|
|
91
|
+
const e2 = await setWalker(schema, {
|
|
92
92
|
$id: 'bl1',
|
|
93
93
|
exclusiveminmax: 6,
|
|
94
94
|
})
|
|
95
95
|
|
|
96
|
-
const res1 = await
|
|
96
|
+
const res1 = await setWalker(schema, {
|
|
97
97
|
$id: 'bl1',
|
|
98
98
|
exclusiveminmax: 4,
|
|
99
99
|
})
|
|
100
100
|
|
|
101
|
-
const res2 = await
|
|
101
|
+
const res2 = await setWalker(schema, {
|
|
102
102
|
$id: 'bl1',
|
|
103
103
|
exclusiveminmax: 5,
|
|
104
104
|
})
|
|
@@ -112,97 +112,97 @@ test('min-max exclusive', async (t) => {
|
|
|
112
112
|
})
|
|
113
113
|
|
|
114
114
|
test('isInteger', async (t) => {
|
|
115
|
-
const e1 = await
|
|
115
|
+
const e1 = await setWalker(schema, {
|
|
116
116
|
$id: 'bl1',
|
|
117
117
|
integer: 6.5,
|
|
118
118
|
})
|
|
119
119
|
|
|
120
|
-
const res1 = await
|
|
120
|
+
const res1 = await setWalker(schema, {
|
|
121
121
|
$id: 'bl1',
|
|
122
122
|
integer: 5,
|
|
123
123
|
})
|
|
124
124
|
|
|
125
|
-
t.assert(errorCollect(
|
|
126
|
-
t.deepEqual(resultCollect(
|
|
125
|
+
t.assert(errorCollect(e1).length > 0)
|
|
126
|
+
t.deepEqual(resultCollect(res1), [{ path: ['integer'], value: 5 }])
|
|
127
127
|
})
|
|
128
128
|
|
|
129
129
|
test('isMultiple', async (t) => {
|
|
130
|
-
const e1 = await
|
|
130
|
+
const e1 = await setWalker(schema, {
|
|
131
131
|
$id: 'bl1',
|
|
132
132
|
multipleOf: 7,
|
|
133
133
|
})
|
|
134
134
|
|
|
135
|
-
const res1 = await
|
|
135
|
+
const res1 = await setWalker(schema, {
|
|
136
136
|
$id: 'bl1',
|
|
137
137
|
multipleOf: 9,
|
|
138
138
|
})
|
|
139
139
|
|
|
140
|
-
t.assert(errorCollect(
|
|
141
|
-
t.deepEqual(resultCollect(
|
|
140
|
+
t.assert(errorCollect(e1).length > 0)
|
|
141
|
+
t.deepEqual(resultCollect(res1), [{ path: ['multipleOf'], value: 9 }])
|
|
142
142
|
})
|
|
143
143
|
|
|
144
144
|
//TODO fix
|
|
145
145
|
test('numbers in a set', async (t) => {
|
|
146
|
-
const e1 = await
|
|
146
|
+
const e1 = await setWalker(schema, {
|
|
147
147
|
$id: 'bl1',
|
|
148
148
|
set: [9, 4, 5, 2],
|
|
149
149
|
})
|
|
150
|
-
const res1 = await
|
|
150
|
+
const res1 = await setWalker(schema, { $id: 'bl1', set: [3, 3, 3, 3] })
|
|
151
151
|
|
|
152
|
-
t.assert(errorCollect(
|
|
153
|
-
t.deepEqual(resultCollect(
|
|
152
|
+
t.assert(errorCollect(e1).length > 0)
|
|
153
|
+
t.deepEqual(resultCollect(res1), [
|
|
154
154
|
{ path: ['set'], value: { $value: [3, 3, 3, 3] } },
|
|
155
155
|
])
|
|
156
156
|
})
|
|
157
157
|
//TODO fix
|
|
158
158
|
test('value', async (t) => {
|
|
159
|
-
const e1 = await
|
|
159
|
+
const e1 = await setWalker(schema, {
|
|
160
160
|
$id: 'bl1',
|
|
161
161
|
number: { $value: 7 },
|
|
162
162
|
})
|
|
163
|
-
const e2 = await
|
|
163
|
+
const e2 = await setWalker(schema, {
|
|
164
164
|
$id: 'bl1',
|
|
165
165
|
exclusiveminmax: { $value: 3 },
|
|
166
166
|
})
|
|
167
|
-
const e3 = await
|
|
167
|
+
const e3 = await setWalker(schema, {
|
|
168
168
|
$id: 'bl1',
|
|
169
169
|
integer: { value: 3.5 },
|
|
170
170
|
})
|
|
171
171
|
|
|
172
|
-
const e4 = await
|
|
172
|
+
const e4 = await setWalker(schema, {
|
|
173
173
|
$id: 'bl1',
|
|
174
174
|
set: { $value: [1, 3, 3, 4] },
|
|
175
175
|
})
|
|
176
176
|
|
|
177
|
-
const e5 = await
|
|
177
|
+
const e5 = await setWalker(schema, {
|
|
178
178
|
$id: 'bl1',
|
|
179
179
|
multipleOf: { $value: 2 },
|
|
180
180
|
})
|
|
181
181
|
|
|
182
|
-
const res1 = await
|
|
182
|
+
const res1 = await setWalker(schema, {
|
|
183
183
|
$id: 'bl1',
|
|
184
184
|
number: { $value: 4 },
|
|
185
185
|
})
|
|
186
|
-
const res2 = await
|
|
186
|
+
const res2 = await setWalker(schema, {
|
|
187
187
|
$id: 'bl1',
|
|
188
188
|
integer: { $value: 4 },
|
|
189
189
|
})
|
|
190
|
-
const res3 = await
|
|
190
|
+
const res3 = await setWalker(schema, {
|
|
191
191
|
$id: 'bl1',
|
|
192
192
|
exclusiveminmax: { $value: 4 },
|
|
193
193
|
})
|
|
194
|
-
const res4 = await
|
|
194
|
+
const res4 = await setWalker(schema, {
|
|
195
195
|
$id: 'bl1',
|
|
196
196
|
multipleOf: { $value: 6 },
|
|
197
197
|
})
|
|
198
198
|
|
|
199
|
-
const res5 = await
|
|
199
|
+
const res5 = await setWalker(schema, {
|
|
200
200
|
$id: 'bl1',
|
|
201
201
|
set: { $value: [3, 3, 3, 4] },
|
|
202
202
|
})
|
|
203
203
|
|
|
204
|
-
t.assert(errorCollect(
|
|
205
|
-
t.deepEqual(resultCollect(
|
|
204
|
+
t.assert(errorCollect(e1, e2, e3, e4, e5).length > 0)
|
|
205
|
+
t.deepEqual(resultCollect(res1, res2, res3, res4), [
|
|
206
206
|
// t.deepEqual(resultCollect([res1, res2, res3, res4, res5]), [
|
|
207
207
|
{ path: ['number'], value: 4 },
|
|
208
208
|
{ path: ['integer'], value: 4 },
|
|
@@ -214,53 +214,58 @@ test('value', async (t) => {
|
|
|
214
214
|
|
|
215
215
|
//TODO fix
|
|
216
216
|
test('default', async (t) => {
|
|
217
|
-
const e1 = await
|
|
217
|
+
const e1 = await setWalker(schema, {
|
|
218
218
|
$id: 'bl1',
|
|
219
219
|
number: { $default: 7 },
|
|
220
220
|
})
|
|
221
|
-
const e2 = await
|
|
221
|
+
const e2 = await setWalker(schema, {
|
|
222
222
|
$id: 'bl1',
|
|
223
223
|
exclusiveminmax: { $default: 3 },
|
|
224
224
|
})
|
|
225
|
-
const e3 = await
|
|
225
|
+
const e3 = await setWalker(schema, {
|
|
226
226
|
$id: 'bl1',
|
|
227
227
|
integer: { default: 3.5 },
|
|
228
228
|
})
|
|
229
229
|
|
|
230
|
-
const e4 = await
|
|
230
|
+
const e4 = await setWalker(schema, {
|
|
231
231
|
$id: 'bl1',
|
|
232
232
|
set: { $default: [1, 3, 3, 4] },
|
|
233
233
|
})
|
|
234
234
|
|
|
235
|
-
const e5 = await
|
|
235
|
+
const e5 = await setWalker(schema, {
|
|
236
236
|
$id: 'bl1',
|
|
237
237
|
multipleOf: { $default: 2 },
|
|
238
238
|
})
|
|
239
239
|
|
|
240
|
-
const res1 = await
|
|
240
|
+
const res1 = await setWalker(schema, {
|
|
241
241
|
$id: 'bl1',
|
|
242
242
|
number: { $default: 4 },
|
|
243
243
|
})
|
|
244
|
-
const res2 = await
|
|
244
|
+
const res2 = await setWalker(schema, {
|
|
245
245
|
$id: 'bl1',
|
|
246
246
|
integer: { $default: 4 },
|
|
247
247
|
})
|
|
248
|
-
const res3 = await
|
|
248
|
+
const res3 = await setWalker(schema, {
|
|
249
249
|
$id: 'bl1',
|
|
250
250
|
exclusiveminmax: { $default: 4 },
|
|
251
251
|
})
|
|
252
|
-
const res4 = await
|
|
252
|
+
const res4 = await setWalker(schema, {
|
|
253
253
|
$id: 'bl1',
|
|
254
254
|
multipleOf: { $default: 6 },
|
|
255
255
|
})
|
|
256
256
|
|
|
257
|
-
const res5 = await
|
|
257
|
+
const res5 = await setWalker(schema, {
|
|
258
258
|
$id: 'bl1',
|
|
259
259
|
set: { $default: [3, 3, 3, 4] },
|
|
260
260
|
})
|
|
261
261
|
|
|
262
|
-
|
|
263
|
-
|
|
262
|
+
//is this issue?
|
|
263
|
+
console.dir(
|
|
264
|
+
res5.collected.map((v) => ({ path: v.path, value: v.value })),
|
|
265
|
+
{ depth: 10 }
|
|
266
|
+
)
|
|
267
|
+
t.assert(errorCollect(e1, e2, e3, e4, e5).length > 0)
|
|
268
|
+
t.deepEqual(resultCollect(res1, res2, res3, res4, res5), [
|
|
264
269
|
{ path: ['number'], value: { $default: 4 } },
|
|
265
270
|
{ path: ['integer'], value: { $default: 4 } },
|
|
266
271
|
{ path: ['exclusiveminmax'], value: { $default: 4 } },
|
|
@@ -271,58 +276,58 @@ test('default', async (t) => {
|
|
|
271
276
|
|
|
272
277
|
test('decrement', async (t) => {
|
|
273
278
|
//maxmin
|
|
274
|
-
const e1 = await
|
|
279
|
+
const e1 = await setWalker(schema, {
|
|
275
280
|
$id: 'bl1',
|
|
276
281
|
number: { $decrement: 2 },
|
|
277
282
|
})
|
|
278
|
-
const e2 = await
|
|
283
|
+
const e2 = await setWalker(schema, {
|
|
279
284
|
$id: 'bl1',
|
|
280
285
|
number: { $decrement: 7 },
|
|
281
286
|
})
|
|
282
287
|
|
|
283
|
-
const res1 = await
|
|
288
|
+
const res1 = await setWalker(schema, {
|
|
284
289
|
$id: 'bl1',
|
|
285
290
|
number: { $decrement: 3 },
|
|
286
291
|
})
|
|
287
292
|
//exclusiveminmax
|
|
288
|
-
const e3 = await
|
|
293
|
+
const e3 = await setWalker(schema, {
|
|
289
294
|
$id: 'bl1',
|
|
290
295
|
exclusiveminmax: { $decrement: 3 },
|
|
291
296
|
})
|
|
292
|
-
const e4 = await
|
|
297
|
+
const e4 = await setWalker(schema, {
|
|
293
298
|
$id: 'bl1',
|
|
294
299
|
exclusiveminmax: { $decrement: 6 },
|
|
295
300
|
})
|
|
296
301
|
|
|
297
|
-
const res2 = await
|
|
302
|
+
const res2 = await setWalker(schema, {
|
|
298
303
|
$id: 'bl1',
|
|
299
304
|
exclusiveminmax: { $decrement: 4 },
|
|
300
305
|
})
|
|
301
306
|
|
|
302
307
|
//integer
|
|
303
|
-
const e5 = await
|
|
308
|
+
const e5 = await setWalker(schema, {
|
|
304
309
|
$id: 'bl1',
|
|
305
310
|
integer: { $decrement: 3.5 },
|
|
306
311
|
})
|
|
307
312
|
|
|
308
|
-
const res3 = await
|
|
313
|
+
const res3 = await setWalker(schema, {
|
|
309
314
|
$id: 'bl1',
|
|
310
315
|
integer: { $decrement: 3 },
|
|
311
316
|
})
|
|
312
317
|
//multiple of
|
|
313
318
|
|
|
314
|
-
const e6 = await
|
|
319
|
+
const e6 = await setWalker(schema, {
|
|
315
320
|
$id: 'bl1',
|
|
316
321
|
multipleOf: { $decrement: 7 },
|
|
317
322
|
})
|
|
318
323
|
|
|
319
|
-
const res4 = await
|
|
324
|
+
const res4 = await setWalker(schema, {
|
|
320
325
|
$id: 'bl1',
|
|
321
326
|
multipleOf: { $decrement: 9 },
|
|
322
327
|
})
|
|
323
328
|
|
|
324
|
-
t.assert(errorCollect(
|
|
325
|
-
t.deepEqual(resultCollect(
|
|
329
|
+
t.assert(errorCollect(e1, e2, e3, e4, e5, e6).length > 0)
|
|
330
|
+
t.deepEqual(resultCollect(res1, res2, res3, res4), [
|
|
326
331
|
{ path: ['number'], value: { $decrement: 3 } },
|
|
327
332
|
{ path: ['exclusiveminmax'], value: { $decrement: 4 } },
|
|
328
333
|
{ path: ['integer'], value: { $decrement: 3 } },
|
|
@@ -332,58 +337,58 @@ test('decrement', async (t) => {
|
|
|
332
337
|
|
|
333
338
|
test('increment', async (t) => {
|
|
334
339
|
//maxmin
|
|
335
|
-
const e1 = await
|
|
340
|
+
const e1 = await setWalker(schema, {
|
|
336
341
|
$id: 'bl1',
|
|
337
342
|
number: { $increment: 2 },
|
|
338
343
|
})
|
|
339
|
-
const e2 = await
|
|
344
|
+
const e2 = await setWalker(schema, {
|
|
340
345
|
$id: 'bl1',
|
|
341
346
|
number: { $increment: 7 },
|
|
342
347
|
})
|
|
343
348
|
|
|
344
|
-
const res1 = await
|
|
349
|
+
const res1 = await setWalker(schema, {
|
|
345
350
|
$id: 'bl1',
|
|
346
351
|
number: { $increment: 3 },
|
|
347
352
|
})
|
|
348
353
|
//exclusiveminmax
|
|
349
|
-
const e3 = await
|
|
354
|
+
const e3 = await setWalker(schema, {
|
|
350
355
|
$id: 'bl1',
|
|
351
356
|
exclusiveminmax: { $increment: 3 },
|
|
352
357
|
})
|
|
353
|
-
const e4 = await
|
|
358
|
+
const e4 = await setWalker(schema, {
|
|
354
359
|
$id: 'bl1',
|
|
355
360
|
exclusiveminmax: { $increment: 6 },
|
|
356
361
|
})
|
|
357
362
|
|
|
358
|
-
const res2 = await
|
|
363
|
+
const res2 = await setWalker(schema, {
|
|
359
364
|
$id: 'bl1',
|
|
360
365
|
exclusiveminmax: { $increment: 4 },
|
|
361
366
|
})
|
|
362
367
|
|
|
363
368
|
//integer
|
|
364
|
-
const e5 = await
|
|
369
|
+
const e5 = await setWalker(schema, {
|
|
365
370
|
$id: 'bl1',
|
|
366
371
|
integer: { $increment: 3.5 },
|
|
367
372
|
})
|
|
368
373
|
|
|
369
|
-
const res3 = await
|
|
374
|
+
const res3 = await setWalker(schema, {
|
|
370
375
|
$id: 'bl1',
|
|
371
376
|
integer: { $increment: 3 },
|
|
372
377
|
})
|
|
373
378
|
//multiple of
|
|
374
379
|
|
|
375
|
-
const e6 = await
|
|
380
|
+
const e6 = await setWalker(schema, {
|
|
376
381
|
$id: 'bl1',
|
|
377
382
|
multipleOf: { $increment: 7 },
|
|
378
383
|
})
|
|
379
384
|
|
|
380
|
-
const res4 = await
|
|
385
|
+
const res4 = await setWalker(schema, {
|
|
381
386
|
$id: 'bl1',
|
|
382
387
|
multipleOf: { $increment: 9 },
|
|
383
388
|
})
|
|
384
389
|
|
|
385
|
-
t.assert(errorCollect(
|
|
386
|
-
t.deepEqual(resultCollect(
|
|
390
|
+
t.assert(errorCollect(e1, e2, e3, e4, e5, e6).length > 0)
|
|
391
|
+
t.deepEqual(resultCollect(res1, res2, res3, res4), [
|
|
387
392
|
{ path: ['number'], value: { $increment: 3 } },
|
|
388
393
|
{ path: ['exclusiveminmax'], value: { $increment: 4 } },
|
|
389
394
|
{ path: ['integer'], value: { $increment: 3 } },
|