Skip to content

Commit feebc28

Browse files
test: add test for issue #491 (#521)
1 parent ab900c8 commit feebc28

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/date.test.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,3 +525,22 @@ test('nullable date', (t) => {
525525

526526
t.same(result, `"${DateTime.fromJSDate(data).toISODate()}"`)
527527
})
528+
529+
test('non-date format should not affect data serialization (issue #491)', (t) => {
530+
t.plan(1)
531+
532+
const schema = {
533+
type: 'object',
534+
properties: {
535+
hello: {
536+
type: 'string',
537+
format: 'int64',
538+
pattern: '^[0-9]*$'
539+
}
540+
}
541+
}
542+
543+
const stringify = build(schema)
544+
const data = { hello: 123n }
545+
t.equal(stringify(data), '{"hello":"123"}')
546+
})

0 commit comments

Comments
 (0)