test: fix inconsistent test

This commit is contained in:
endiliey 2018-09-07 21:51:18 +08:00
parent 0f38ae3979
commit 0cef519e7f
3 changed files with 389 additions and 569 deletions

View file

@ -4,12 +4,17 @@ import path from 'path';
describe('loadPages', () => {
test('valid pages', async () => {
const pagesDir = path.join(__dirname, '__fixtures__', 'simple-pages');
const pagesData = await loadPages(pagesDir);
let pagesData = await loadPages(pagesDir);
pagesData.sort((a, b) => a.path > b.path); // because it was unordered
expect(pagesData).toEqual([
{
path: '/',
source: 'index.js'
},
{
path: '/bar/baz',
source: 'bar/baz.js'
},
{
path: '/foo',
source: 'foo.js'
@ -17,10 +22,6 @@ describe('loadPages', () => {
{
path: '/foo/',
source: 'foo/index.js'
},
{
path: '/bar/baz',
source: 'bar/baz.js'
}
]);
expect(pagesData).not.toBeNull();