fix(v2): handle non existent blog, docs, pages (#1459)

* fix(v2): handle non existent blog, docs, pages

* nits
This commit is contained in:
Endi 2019-05-15 13:55:07 +07:00 committed by GitHub
parent f84abfe2d1
commit 55d7920825
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 41 additions and 12 deletions

View file

@ -12,18 +12,18 @@ import loadSidebars from '../sidebars';
describe('loadSidebars', () => {
test('normal site with sidebars', async () => {
const sidebar = require(path.join(
const sidebarPath = path.join(
__dirname,
'__fixtures__',
'website',
'sidebars.json',
));
const result = loadSidebars({sidebar});
);
const result = loadSidebars(sidebarPath);
expect(result).toMatchSnapshot();
});
test('site without sidebars', () => {
const result = loadSidebars({sidebar: {}});
const result = loadSidebars(null);
expect(result).toMatchSnapshot();
});
});