mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-12 08:37:25 +02:00
misc(v2): remove legacy from docs
This commit is contained in:
parent
e3f25b2a45
commit
54e9e025d8
34 changed files with 24 additions and 24 deletions
|
@ -0,0 +1,52 @@
|
|||
/**
|
||||
* Copyright (c) 2017-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import path from 'path';
|
||||
import loadSidebars from '../sidebars';
|
||||
|
||||
/* eslint-disable global-require, import/no-dynamic-require */
|
||||
|
||||
describe('loadSidebars', () => {
|
||||
test('sidebars with known sidebar item type', async () => {
|
||||
const sidebarPath = path.join(
|
||||
__dirname,
|
||||
'__fixtures__',
|
||||
'website',
|
||||
'sidebars.json',
|
||||
);
|
||||
const result = loadSidebars(sidebarPath);
|
||||
expect(result).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('sidebars with deep level of category', async () => {
|
||||
const sidebarPath = path.join(
|
||||
__dirname,
|
||||
'__fixtures__',
|
||||
'website',
|
||||
'sidebars-category.js',
|
||||
);
|
||||
const result = loadSidebars(sidebarPath);
|
||||
expect(result).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('sidebars with unknown sidebar item type', async () => {
|
||||
const sidebarPath = path.join(
|
||||
__dirname,
|
||||
'__fixtures__',
|
||||
'website',
|
||||
'bad-sidebars.json',
|
||||
);
|
||||
expect(() => loadSidebars(sidebarPath)).toThrowErrorMatchingInlineSnapshot(
|
||||
`"Unknown sidebar item type: superman"`,
|
||||
);
|
||||
});
|
||||
|
||||
test('no sidebars', () => {
|
||||
const result = loadSidebars(null);
|
||||
expect(result).toEqual({});
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue