mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-14 16:52:39 +02:00
test(v2): add tests for config validation (#3142)
* test(v2): add tests for correctly defined fields * test(v2): add test for remarkPlugins and rehypePlugins validation * test(v2): modify tests and comments
This commit is contained in:
parent
ee2d1b42f6
commit
e7ec93b0b9
7 changed files with 144 additions and 69 deletions
|
@ -63,10 +63,20 @@ export const PluginOptionSchema = Joi.object({
|
|||
truncateMarker: Joi.object().default(DEFAULT_OPTIONS.truncateMarker),
|
||||
admonitions: Joi.object().default(DEFAULT_OPTIONS.admonitions),
|
||||
beforeDefaultRemarkPlugins: Joi.array()
|
||||
.items(Joi.object())
|
||||
.items(
|
||||
Joi.array()
|
||||
.items(Joi.function().required(), Joi.object().required())
|
||||
.length(2),
|
||||
Joi.function(),
|
||||
)
|
||||
.default(DEFAULT_OPTIONS.beforeDefaultRemarkPlugins),
|
||||
beforeDefaultRehypePlugins: Joi.array()
|
||||
.items(Joi.object())
|
||||
.items(
|
||||
Joi.array()
|
||||
.items(Joi.function().required(), Joi.object().required())
|
||||
.length(2),
|
||||
Joi.function(),
|
||||
)
|
||||
.default(DEFAULT_OPTIONS.beforeDefaultRehypePlugins),
|
||||
feedOptions: Joi.object({
|
||||
type: Joi.alternatives().conditional(
|
||||
|
@ -75,8 +85,8 @@ export const PluginOptionSchema = Joi.object({
|
|||
then: Joi.custom((val) => (val === 'all' ? ['rss', 'atom'] : [val])),
|
||||
},
|
||||
),
|
||||
title: Joi.string(),
|
||||
description: Joi.string(),
|
||||
title: Joi.string().allow(''),
|
||||
description: Joi.string().allow(''),
|
||||
copyright: Joi.string(),
|
||||
language: Joi.string(),
|
||||
}).default(DEFAULT_OPTIONS.feedOptions),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue