Skip to content

Commit e1de9f0

Browse files
committed
refactor: fix breaking build
1 parent 50bf2c2 commit e1de9f0

File tree

5 files changed

+123
-123
lines changed

5 files changed

+123
-123
lines changed

tests/integration/compiler/array_node.spec.ts

+24-24
Original file line numberDiff line numberDiff line change
@@ -339,10 +339,10 @@ test.group('Array node', () => {
339339

340340
const refs: Record<string, ValidationRule> = {
341341
'ref://2': {
342-
validator(value, options, ctx) {
342+
validator(value, options, field) {
343343
assert.deepEqual(value, ['hello world', 'hi world'])
344344
assert.isUndefined(options)
345-
assert.containsSubset(ctx, {
345+
assert.containsSubset(field, {
346346
fieldName: '',
347347
isArrayMember: false,
348348
isValid: true,
@@ -353,10 +353,10 @@ test.group('Array node', () => {
353353
},
354354
},
355355
'ref://3': {
356-
validator(value, options, ctx) {
356+
validator(value, options, field) {
357357
assert.deepEqual(value, ['hello world', 'hi world'])
358358
assert.isUndefined(options)
359-
assert.containsSubset(ctx, {
359+
assert.containsSubset(field, {
360360
fieldName: '',
361361
isArrayMember: false,
362362
isValid: true,
@@ -417,18 +417,18 @@ test.group('Array node', () => {
417417

418418
const refs: Record<string, ValidationRule> = {
419419
'ref://2': {
420-
validator(value, options, ctx) {
420+
validator(value, options, field) {
421421
assert.deepEqual(value, ['hello world', 'hi world'])
422422
assert.isUndefined(options)
423-
assert.containsSubset(ctx, {
423+
assert.containsSubset(field, {
424424
fieldName: '',
425425
isArrayMember: false,
426426
isValid: true,
427427
meta: {},
428428
parent: data,
429429
data,
430430
})
431-
ctx.report('ref://2 validation failed', 'ref', ctx)
431+
field.report('ref://2 validation failed', 'ref', field)
432432
},
433433
},
434434
'ref://3': {
@@ -492,25 +492,25 @@ test.group('Array node', () => {
492492

493493
const refs: Record<string, ValidationRule> = {
494494
'ref://2': {
495-
validator(value, options, ctx) {
495+
validator(value, options, field) {
496496
assert.deepEqual(value, ['hello world', 'hi world'])
497497
assert.isUndefined(options)
498-
assert.containsSubset(ctx, {
498+
assert.containsSubset(field, {
499499
fieldName: '',
500500
isArrayMember: false,
501501
isValid: true,
502502
meta: {},
503503
parent: data,
504504
data,
505505
})
506-
ctx.report('ref://2 validation failed', 'ref', ctx)
506+
field.report('ref://2 validation failed', 'ref', field)
507507
},
508508
},
509509
'ref://3': {
510-
validator(value, options, ctx) {
510+
validator(value, options, field) {
511511
assert.deepEqual(value, ['hello world', 'hi world'])
512512
assert.isUndefined(options)
513-
assert.containsSubset(ctx, {
513+
assert.containsSubset(field, {
514514
fieldName: '',
515515
isArrayMember: false,
516516
isValid: false,
@@ -577,18 +577,18 @@ test.group('Array node', () => {
577577

578578
const refs: Record<string, ValidationRule> = {
579579
'ref://2': {
580-
validator(value, options, ctx) {
580+
validator(value, options, field) {
581581
assert.deepEqual(value, ['hello world', 'hi world'])
582582
assert.isUndefined(options)
583-
assert.containsSubset(ctx, {
583+
assert.containsSubset(field, {
584584
fieldName: '',
585585
isArrayMember: false,
586586
isValid: true,
587587
meta: {},
588588
parent: data,
589589
data,
590590
})
591-
ctx.report('ref://2 validation failed', 'ref', ctx)
591+
field.report('ref://2 validation failed', 'ref', field)
592592
},
593593
},
594594
'ref://3': {
@@ -653,36 +653,36 @@ test.group('Array node', () => {
653653

654654
const refs: Record<string, ValidationRule> = {
655655
'ref://2': {
656-
validator(value, options, ctx) {
656+
validator(value, options, field) {
657657
assert.deepEqual(value, ['hello world', 'hi world'])
658658
assert.isUndefined(options)
659-
assert.containsSubset(ctx, {
659+
assert.containsSubset(field, {
660660
fieldName: '',
661661
isArrayMember: false,
662662
isValid: true,
663663
meta: {},
664664
parent: data,
665665
data,
666666
})
667-
ctx.report('ref://2 validation failed', 'ref', ctx)
667+
field.report('ref://2 validation failed', 'ref', field)
668668
},
669669
},
670670
'ref://3': {
671-
validator(value, options, ctx) {
671+
validator(value, options, field) {
672672
assert.oneOf(value, ['hello world', 'hi world'])
673673
assert.isUndefined(options)
674-
assert.containsSubset(ctx, {
674+
assert.containsSubset(field, {
675675
isArrayMember: true,
676676
isValid: true,
677677
meta: {},
678678
parent: ['hello world', 'hi world'],
679679
data,
680680
})
681-
assert.oneOf(ctx.fieldName, [0, 1])
682-
assert.equal(ctx.wildCardPath, '*')
681+
assert.oneOf(field.name, [0, 1])
682+
assert.equal(field.wildCardPath, '*')
683683

684-
if (ctx.isArrayMember) {
685-
assert.equal(ctx.parent[ctx.fieldName], value)
684+
if (field.isArrayMember) {
685+
assert.equal(field.parent[field.name], value)
686686
}
687687
},
688688
},

tests/integration/compiler/literal_node.spec.ts

+31-31
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,10 @@ test.group('Literal node', () => {
161161

162162
const refs: Record<string, ValidationRule> = {
163163
'ref://2': {
164-
validator(value, options, ctx) {
164+
validator(value, options, field) {
165165
assert.equal(value, 'virk')
166166
assert.isUndefined(options)
167-
assert.containsSubset(ctx, {
167+
assert.containsSubset(field, {
168168
fieldName: '',
169169
isArrayMember: false,
170170
isValid: true,
@@ -175,10 +175,10 @@ test.group('Literal node', () => {
175175
},
176176
},
177177
'ref://3': {
178-
validator(value, options, ctx) {
178+
validator(value, options, field) {
179179
assert.equal(value, 'virk')
180180
assert.isUndefined(options)
181-
assert.containsSubset(ctx, {
181+
assert.containsSubset(field, {
182182
fieldName: '',
183183
isArrayMember: false,
184184
isValid: true,
@@ -230,25 +230,25 @@ test.group('Literal node', () => {
230230

231231
const refs: Record<string, ValidationRule> = {
232232
'ref://2': {
233-
validator(value, options, ctx) {
233+
validator(value, options, field) {
234234
assert.equal(value, 'virk')
235235
assert.isUndefined(options)
236-
assert.containsSubset(ctx, {
236+
assert.containsSubset(field, {
237237
fieldName: '',
238238
isArrayMember: false,
239239
isValid: true,
240240
meta: {},
241241
parent: data,
242242
data,
243243
})
244-
ctx.report('ref://2 validation failed', 'ref://2', ctx)
244+
field.report('ref://2 validation failed', 'ref://2', field)
245245
},
246246
},
247247
'ref://3': {
248-
validator(value, options, ctx) {
248+
validator(value, options, field) {
249249
assert.equal(value, 'virk')
250250
assert.isUndefined(options)
251-
assert.containsSubset(ctx, {
251+
assert.containsSubset(field, {
252252
fieldName: '',
253253
isArrayMember: false,
254254
isValid: true,
@@ -304,25 +304,25 @@ test.group('Literal node', () => {
304304

305305
const refs: Record<string, ValidationRule> = {
306306
'ref://2': {
307-
validator(value, options, ctx) {
307+
validator(value, options, field) {
308308
assert.equal(value, 'virk')
309309
assert.isUndefined(options)
310-
assert.containsSubset(ctx, {
310+
assert.containsSubset(field, {
311311
fieldName: '',
312312
isArrayMember: false,
313313
isValid: true,
314314
meta: {},
315315
parent: data,
316316
data,
317317
})
318-
ctx.report('ref://2 validation failed', 'ref://2', ctx)
318+
field.report('ref://2 validation failed', 'ref://2', field)
319319
},
320320
},
321321
'ref://3': {
322-
validator(value, options, ctx) {
322+
validator(value, options, field) {
323323
assert.equal(value, 'virk')
324324
assert.isUndefined(options)
325-
assert.containsSubset(ctx, {
325+
assert.containsSubset(field, {
326326
fieldName: '',
327327
isArrayMember: false,
328328
isValid: false,
@@ -377,18 +377,18 @@ test.group('Literal node', () => {
377377
throw new Error('Never expected to reach here')
378378
})
379379
refs.trackValidation({
380-
validator(value, options, ctx) {
380+
validator(value, options, field) {
381381
assert.equal(value, 'virk')
382382
assert.isUndefined(options)
383-
assert.containsSubset(ctx, {
383+
assert.containsSubset(field, {
384384
fieldName: '',
385385
isArrayMember: false,
386386
isValid: true,
387387
meta: {},
388388
parent: data,
389389
data,
390390
})
391-
ctx.report('ref://2 failed', 'ref', ctx)
391+
field.report('ref://2 failed', 'ref', field)
392392
},
393393
})
394394

@@ -435,10 +435,10 @@ test.group('Literal node', () => {
435435
return value.toUpperCase()
436436
})
437437
refs.trackValidation({
438-
validator(value, options, ctx) {
438+
validator(value, options, field) {
439439
assert.equal(value, 'virk')
440440
assert.isUndefined(options)
441-
assert.containsSubset(ctx, {
441+
assert.containsSubset(field, {
442442
fieldName: '',
443443
isArrayMember: false,
444444
isValid: true,
@@ -657,10 +657,10 @@ test.group('Literal node | optional: true', () => {
657657

658658
const refs: Record<string, ValidationRule> = {
659659
'ref://2': {
660-
validator(value, options, ctx) {
660+
validator(value, options, field) {
661661
assert.equal(value, 'virk')
662662
assert.isUndefined(options)
663-
assert.containsSubset(ctx, {
663+
assert.containsSubset(field, {
664664
fieldName: '',
665665
isArrayMember: false,
666666
isValid: true,
@@ -671,10 +671,10 @@ test.group('Literal node | optional: true', () => {
671671
},
672672
},
673673
'ref://3': {
674-
validator(value, options, ctx) {
674+
validator(value, options, field) {
675675
assert.equal(value, 'virk')
676676
assert.isUndefined(options)
677-
assert.containsSubset(ctx, {
677+
assert.containsSubset(field, {
678678
fieldName: '',
679679
isArrayMember: false,
680680
isValid: true,
@@ -782,10 +782,10 @@ test.group('Literal node | optional: true', () => {
782782
},
783783
},
784784
'ref://3': {
785-
validator(value, options, ctx) {
785+
validator(value, options, field) {
786786
assert.equal(value, undefined)
787787
assert.isUndefined(options)
788-
assert.containsSubset(ctx, {
788+
assert.containsSubset(field, {
789789
fieldName: '',
790790
isArrayMember: false,
791791
isValid: true,
@@ -974,10 +974,10 @@ test.group('Literal node | allowNull: true', () => {
974974

975975
const refs: Record<string, ValidationRule> = {
976976
'ref://2': {
977-
validator(value, options, ctx) {
977+
validator(value, options, field) {
978978
assert.equal(value, 'virk')
979979
assert.isUndefined(options)
980-
assert.containsSubset(ctx, {
980+
assert.containsSubset(field, {
981981
fieldName: '',
982982
isArrayMember: false,
983983
isValid: true,
@@ -988,10 +988,10 @@ test.group('Literal node | allowNull: true', () => {
988988
},
989989
},
990990
'ref://3': {
991-
validator(value, options, ctx) {
991+
validator(value, options, field) {
992992
assert.equal(value, 'virk')
993993
assert.isUndefined(options)
994-
assert.containsSubset(ctx, {
994+
assert.containsSubset(field, {
995995
fieldName: '',
996996
isArrayMember: false,
997997
isValid: true,
@@ -1099,10 +1099,10 @@ test.group('Literal node | allowNull: true', () => {
10991099
},
11001100
},
11011101
'ref://3': {
1102-
validator(value, options, ctx) {
1102+
validator(value, options, field) {
11031103
assert.isNull(value)
11041104
assert.isUndefined(options)
1105-
assert.containsSubset(ctx, {
1105+
assert.containsSubset(field, {
11061106
fieldName: '',
11071107
isArrayMember: false,
11081108
isValid: true,

0 commit comments

Comments
 (0)