mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-11 08:07:26 +02:00
* fix: add docs tag validation to solve #5478 fix: add docs tag validation to solve #5478 * Update docFrontMatter.ts * Update docs-create-doc.mdx * improve tag validation error messages + tests * improve tags doc * fix test Co-authored-by: slorber <lorber.sebastien@gmail.com>
This commit is contained in:
parent
812327155b
commit
194f429c1f
5 changed files with 46 additions and 5 deletions
|
@ -242,3 +242,24 @@ describe('validateDocFrontMatter parse_number_prefixes', () => {
|
|||
],
|
||||
});
|
||||
});
|
||||
|
||||
describe('validateDocFrontMatter tags', () => {
|
||||
testField({
|
||||
fieldName: 'tags',
|
||||
validFrontMatters: [{}, {tags: undefined}, {tags: ['tag1', 'tag2']}],
|
||||
convertibleFrontMatter: [[{tags: ['tag1', 42]}, {tags: ['tag1', '42']}]],
|
||||
invalidFrontMatters: [
|
||||
[{tags: 42}, '"tags" does not look like a valid FrontMatter Yaml array.'],
|
||||
[
|
||||
{tags: 'tag1, tag2'},
|
||||
'"tags" does not look like a valid FrontMatter Yaml array.',
|
||||
],
|
||||
[{tags: [{}]}, '"tags[0]" does not look like a valid tag'],
|
||||
[{tags: [true]}, '"tags[0]" does not look like a valid tag'],
|
||||
[
|
||||
{tags: ['tag1', {hey: 'test'}]},
|
||||
'"tags[1]" does not look like a valid tag',
|
||||
],
|
||||
],
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue