mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-28 16:37:07 +02:00
test: load pages
This commit is contained in:
parent
cfd11fbb6d
commit
8f493605ad
6 changed files with 43 additions and 0 deletions
17
test/load/pages.test.js
Normal file
17
test/load/pages.test.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
import loadPages from '@lib/load/pages.js';
|
||||
import path from 'path';
|
||||
|
||||
describe('loadPages', () => {
|
||||
test('valid pages', async () => {
|
||||
const pagesDir = path.join(__dirname, '__fixtures__', 'simple-pages');
|
||||
const pagesData = await loadPages(pagesDir);
|
||||
expect(pagesData).toMatchSnapshot();
|
||||
expect(pagesData).not.toBeNull();
|
||||
});
|
||||
|
||||
test('invalid pages', async () => {
|
||||
const nonExistingDir = path.join(__dirname, '__fixtures__', 'nonExisting');
|
||||
const pagesData = await loadPages(nonExistingDir);
|
||||
expect(pagesData).toEqual([]);
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue