mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-24 22:46:57 +02:00
fix(v2): throw error if first level item of a sidebar is not category (#1994)
This commit is contained in:
parent
472a1a660c
commit
4e5a03fb88
3 changed files with 30 additions and 0 deletions
packages/docusaurus-plugin-content-docs/src/__tests__
|
@ -34,6 +34,16 @@ describe('loadSidebars', () => {
|
|||
);
|
||||
});
|
||||
|
||||
test('sidebars with first level not a category', async () => {
|
||||
const sidebarPath = path.join(
|
||||
fixtureDir,
|
||||
'sidebars-first-level-not-category',
|
||||
);
|
||||
expect(() => loadSidebars(sidebarPath)).toThrowErrorMatchingInlineSnapshot(
|
||||
`"Error loading {\\"type\\":\\"doc\\",\\"id\\":\\"api\\"}. First level item of a sidebar must be a category"`,
|
||||
);
|
||||
});
|
||||
|
||||
test('sidebars with unknown sidebar item type', async () => {
|
||||
const sidebarPath = path.join(fixtureDir, 'sidebars-unknown-type.json');
|
||||
expect(() => loadSidebars(sidebarPath)).toThrowErrorMatchingInlineSnapshot(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue