mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-02 00:09:48 +02:00
test: add easy setup for test cases
This commit is contained in:
parent
b477863a30
commit
31d333b82f
69 changed files with 3387 additions and 24 deletions
|
@ -3,11 +3,7 @@ import path from 'path';
|
|||
|
||||
describe('loadPages', () => {
|
||||
test('valid pages', async () => {
|
||||
const pagesDir = path.join(
|
||||
__dirname,
|
||||
'__fixtures__',
|
||||
'simple-pages'
|
||||
);
|
||||
const pagesDir = path.join(__dirname, '__fixtures__', 'simple-pages');
|
||||
const pagesData = await loadPages(pagesDir);
|
||||
expect(pagesData).toMatchSnapshot();
|
||||
expect(pagesData).not.toBeNull();
|
||||
|
|
|
@ -65,6 +65,7 @@ describe('load utils', () => {
|
|||
versions: []
|
||||
}
|
||||
};
|
||||
const test = {arr: [1, 2, 3]};
|
||||
const variable = 'enabledLanguages';
|
||||
expect(idx(a, [('b', 'c')])).toBeUndefined();
|
||||
expect(idx(b, ['hello'])).toEqual('world');
|
||||
|
@ -79,6 +80,7 @@ describe('load utils', () => {
|
|||
'en',
|
||||
'ja'
|
||||
]);
|
||||
expect(idx(test, ['arr', 0])).toEqual(1);
|
||||
expect(idx(undefined)).toBeUndefined();
|
||||
expect(idx(null)).toBeNull();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue