test: loadPages

This commit is contained in:
endiliey 2018-09-07 13:53:14 +08:00
parent 988232edd4
commit 2141e6ea90
3 changed files with 11 additions and 31 deletions

View file

@ -1,24 +0,0 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`loadDocs simple docs 1`] = `
Array [
Object {
"id": "hello",
"path": "/hello",
"source": "hello.md",
"title": "Hello, World !",
},
Object {
"id": "bar",
"path": "/foo/bar",
"source": "foo/bar.md",
"title": "Bar",
},
Object {
"id": "baz",
"path": "/foo/baz",
"source": "foo/baz.md",
"title": "baz",
},
]
`;

View file

@ -2,21 +2,21 @@
exports[`loadPages valid pages 1`] = `
Array [
Object {
"path": "/",
"source": "index.js",
},
Object {
"path": "/foo",
"source": "foo.js",
},
Object {
"path": "/bar/baz",
"source": "bar/baz.js",
"path": "/",
"source": "index.js",
},
Object {
"path": "/foo/",
"source": "foo/index.js",
},
Object {
"path": "/bar/baz",
"source": "bar/baz.js",
},
]
`;

View file

@ -3,7 +3,11 @@ 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();