Skip to content

Commit 0fd2d0c

Browse files
committed
Updated test
1 parent 6e964fd commit 0fd2d0c

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

test.js

+13-5
Original file line numberDiff line numberDiff line change
@@ -418,13 +418,18 @@ test('patternProperties - object coerce', (t) => {
418418
properties: {},
419419
patternProperties: {
420420
foo: {
421-
type: 'object'
421+
type: 'object',
422+
properties: {
423+
answer: {
424+
type: 'number'
425+
}
426+
}
422427
}
423428
}
424429
})
425430

426-
const obj = { foo: true, ofoo: '42', arrfoo: [1, 2], objfoo: { answer: 42 } }
427-
t.equal('{"foo":{},"ofoo":{},"arrfoo":{},"objfoo":{}}', stringify(obj))
431+
const obj = { objfoo: { answer: 42 } }
432+
t.equal('{"objfoo":{"answer":42}}', stringify(obj))
428433
})
429434

430435
test('patternProperties - array coerce', (t) => {
@@ -435,13 +440,16 @@ test('patternProperties - array coerce', (t) => {
435440
properties: {},
436441
patternProperties: {
437442
foo: {
438-
type: 'array'
443+
type: 'array',
444+
items: {
445+
type: 'string'
446+
}
439447
}
440448
}
441449
})
442450

443451
const obj = { foo: 'true', ofoo: 0, arrfoo: [1, 2], objfoo: { tyrion: 'lannister' } }
444-
t.equal('{"foo":[],"ofoo":[],"arrfoo":[],"objfoo":[]}', stringify(obj))
452+
t.equal('{"foo":["t","r","u","e"],"ofoo":[],"arrfoo":["1","2"],"objfoo":[]}', stringify(obj))
445453
})
446454

447455
test('patternProperties - throw on unknown type', (t) => {

0 commit comments

Comments
 (0)