Skip to content

Commit

Permalink
Add tests for double quote in property name
Browse files Browse the repository at this point in the history
  • Loading branch information
tomastauer committed May 1, 2024
1 parent d4358dc commit 220373f
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions test/sanitize7.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,22 @@ test('required property containing single quote, contains property', (t) => {
t.throws(() => stringify({}), new Error('"\'" is required!'))
})

test('required property containing double quote, contains property', (t) => {
t.plan(1)

const stringify = build({
type: 'object',
properties: {
'"': { type: 'string' }
},
required: [
'"'
]
})

t.throws(() => stringify({}), new Error('""" is required!'))
})

test('required property containing single quote, does not contain property', (t) => {
t.plan(1)

Expand All @@ -34,3 +50,19 @@ test('required property containing single quote, does not contain property', (t)

t.throws(() => stringify({}), new Error('"\'" is required!'))
})

test('required property containing double quote, does not contain property', (t) => {
t.plan(1)

const stringify = build({
type: 'object',
properties: {
a: { type: 'string' }
},
required: [
'"'
]
})

t.throws(() => stringify({}), new Error('""" is required!'))
})

0 comments on commit 220373f

Please sign in to comment.