mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-20 12:37:01 +02:00
fix(v2): docs plugin stability improvement (100% test coverage) (#1912)
* update jest config * add more tests on docs plugin * fix(v2): docs plugin should not add routes if there are no docs * fix * rm -rf coverage * nits * update
This commit is contained in:
parent
ad22c9fab4
commit
a8826b98b3
26 changed files with 464 additions and 71 deletions
|
@ -218,6 +218,29 @@ describe('createOrder', () => {
|
|||
});
|
||||
});
|
||||
|
||||
test('multiple sidebars with unknown sidebar item type', () => {
|
||||
expect(() =>
|
||||
createOrder({
|
||||
docs: [
|
||||
{
|
||||
type: 'category',
|
||||
label: 'Category1',
|
||||
items: [{type: 'endi', id: 'doc1'}, {type: 'doc', id: 'doc2'}],
|
||||
},
|
||||
],
|
||||
otherDocs: [
|
||||
{
|
||||
type: 'category',
|
||||
label: 'Category1',
|
||||
items: [{type: 'doc', id: 'doc5'}],
|
||||
},
|
||||
],
|
||||
}),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"Unknown item type: endi. Item: {\\"type\\":\\"endi\\",\\"id\\":\\"doc1\\"}"`,
|
||||
);
|
||||
});
|
||||
|
||||
test('edge cases', () => {
|
||||
expect(createOrder({})).toEqual({});
|
||||
expect(createOrder(undefined)).toEqual({});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue