From 220373fad4fe4ce249651b63f94ac660aa3d838a Mon Sep 17 00:00:00 2001 From: Tomas Tauer Date: Wed, 1 May 2024 05:36:00 +0200 Subject: [PATCH] Add tests for double quote in property name --- test/sanitize7.test.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/test/sanitize7.test.js b/test/sanitize7.test.js index fb75cb4d..530c1856 100644 --- a/test/sanitize7.test.js +++ b/test/sanitize7.test.js @@ -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) @@ -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!')) +})