2018-10-08 04:09:29 -04:00
|
|
|
/**
|
2020-02-25 10:12:28 -05:00
|
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
2018-10-08 04:09:29 -04:00
|
|
|
*
|
|
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
const {readSidebar} = require('../readMetadata');
|
2018-10-10 11:33:20 -04:00
|
|
|
const sidebarSubcategories = require('./__fixtures__/sidebar-subcategories');
|
2018-10-08 04:09:29 -04:00
|
|
|
|
|
|
|
|
jest.mock('../env', () => ({
|
|
|
|
|
translation: {
|
|
|
|
|
enabled: true,
|
|
|
|
|
enabledLanguages: () => [
|
|
|
|
|
{
|
|
|
|
|
enabled: true,
|
|
|
|
|
name: 'English',
|
|
|
|
|
tag: 'en',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
enabled: true,
|
|
|
|
|
name: '한국어',
|
|
|
|
|
tag: 'ko',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
versioning: {
|
|
|
|
|
enabled: true,
|
|
|
|
|
defaultVersion: '1.0.0',
|
|
|
|
|
},
|
|
|
|
|
}));
|
|
|
|
|
|
2018-11-28 02:34:16 -05:00
|
|
|
jest.mock(`${process.cwd()}/siteConfig.js`, () => ({}), {virtual: true});
|
2019-12-09 18:57:59 -05:00
|
|
|
jest.mock(`${process.cwd()}/sidebars.json`, () => true, {virtual: true});
|
2018-10-08 04:09:29 -04:00
|
|
|
|
|
|
|
|
describe('readMetadata', () => {
|
|
|
|
|
describe('readSidebar', () => {
|
2018-10-10 11:33:20 -04:00
|
|
|
test('should verify sub category data and verify order', () => {
|
|
|
|
|
const items = readSidebar(sidebarSubcategories);
|
|
|
|
|
expect(items).toMatchSnapshot();
|
2018-10-08 04:09:29 -04:00
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|