From 84129fee192bf39e708b3a89b1a467a6896fb25e Mon Sep 17 00:00:00 2001 From: Lars Trieloff Date: Tue, 14 Apr 2020 09:03:56 +0000 Subject: [PATCH] test(enum): test enums that have arrays as values see #219 --- test/fixtures/enums/arrayenums.schema.json | 29 ++++++++++++++++++++++ test/markdownBuilder.test.js | 5 ++++ 2 files changed, 34 insertions(+) create mode 100644 test/fixtures/enums/arrayenums.schema.json diff --git a/test/fixtures/enums/arrayenums.schema.json b/test/fixtures/enums/arrayenums.schema.json new file mode 100644 index 00000000..ff9ee009 --- /dev/null +++ b/test/fixtures/enums/arrayenums.schema.json @@ -0,0 +1,29 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "file://foo/mod.json", + "title": "MI", + "description": "Specification for input JSON", + "type": "object", + "properties": { + "columns": { + "title": "Columns", + "meta:enum": { + "[\"P\",\"M\"]": "Post Meridiem?" + }, + "enum": [ + [ + "P", + "M" + ], + [ + "M", + "P" + ] + ], + "type": "array" + } + }, + "required": [ + "columns" + ] +} \ No newline at end of file diff --git a/test/markdownBuilder.test.js b/test/markdownBuilder.test.js index c9fef705..06327ed2 100644 --- a/test/markdownBuilder.test.js +++ b/test/markdownBuilder.test.js @@ -169,6 +169,11 @@ describe('Testing Markdown Builder: enums', () => { .contains('bar: foo') .contains('**enum**: the value of this property must be equal to one of the following values:'); }); + + it('Array Enums Schema looks OK', () => { + assertMarkdown(results.arrayenums) + .contains('| `["P","M"]` | Post Meridiem? |'); + }); }); describe('Testing Markdown Builder: null', () => {