Skip to content

Commit

Permalink
test(examples): add test for example formatting with Markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
trieloff committed Mar 4, 2020
1 parent f852d0d commit a2bbe29
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/fixtures/format/format.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,11 @@
"title": "Value",
"description": "Date to be displayed."
}
}
},
"examples": [
{
"format": "Coolness",
"value": "Maximum"
}
]
}
33 changes: 33 additions & 0 deletions test/markdownBuilder.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,39 @@ describe('Testing Markdown Builder: format', () => {
assertMarkdown(results.format)
.fuzzy`Formatting used to display the date.`;
});

it('Format Schema has JSON examples', () => {
assertMarkdown(results.format)
.fuzzy`## Properties Examples
\`\`\`json
{
"format": "Coolness",
"value": "Maximum"
}
\`\`\``;
});
});

describe('Testing Markdown Builder: YAML examples', () => {
let results;

before(async () => {
const schemas = await loadschemas('format');
const builder = build({ header: false, exampleformat: 'yaml' });
results = builder(schemas);
});

it('Format Schema has JSON examples', () => {
assertMarkdown(results.format)
.fuzzy`## Properties Examples
\`\`\`yaml
format: Coolness
value: Maximum
\`\`\``;
});
});

describe('Testing Markdown Builder: enums', () => {
Expand Down

0 comments on commit a2bbe29

Please sign in to comment.