Revert "Add ability to specify sub categories in sidebar.json (#891)"

This reverts commit 16087b4428.
This commit is contained in:
Yangshun Tay 2018-08-06 18:58:54 -07:00 committed by GitHub
parent 16087b4428
commit d2b30dc3ed
14 changed files with 86 additions and 533 deletions

View file

@ -88,63 +88,4 @@ describe('server utils', () => {
expect(utils.getSubDir(docE, docsDir)).toBeNull();
expect(utils.getSubDir(docE, translatedDir)).toEqual('lol/lah');
});
describe('validateSidebar', () => {
test('should throw an error for invalid pages', () => {
const metadata = {
id: 'doc1',
sidebar: 'docs',
next_id: 'doc2',
next: 'doc2',
};
const pages = {
doc1: {},
};
expect(() => {
utils.validateSidebar(metadata, pages);
}).toThrow(
`Improper sidebars.json file, document with id 'doc2' not found. Make sure that documents with the ids specified in sidebars.json exist and that no ids are repeated.`
);
});
test('should throw an error for invalid version pages', () => {
const metadata = {
id: 'doc1',
version: 'foo',
sidebar: 'docs',
next_id: 'doc2',
next: 'doc2',
};
const pages = {
doc1: {},
};
expect(() => {
utils.validateSidebar(metadata, pages);
}).toThrow(
`Improper sidebars file for version foo, document with id 'doc2' not found. Make sure that all documents with ids specified in this version's sidebar file exist and that no ids are repeated.`
);
});
test('should pass validate', () => {
const metadata = {
id: 'doc1',
sidebar: 'docs',
next_id: 'doc2',
next: 'doc2',
};
const pages = {
doc1: {},
doc2: {},
};
expect(() => {
utils.validateSidebar(metadata, pages);
}).not.toThrow();
});
});
});