Skip to content

Commit

Permalink
paths.test.ts: Array order is not important
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobbe committed May 18, 2021
1 parent 6a8b181 commit 0826b7d
Showing 1 changed file with 32 additions and 20 deletions.
52 changes: 32 additions & 20 deletions packages/internal/src/__tests__/paths.test.ts
Expand Up @@ -16,39 +16,51 @@ describe('paths', () => {
)

const pages = processPagesDir(pagesDir)
expect(pages[0].importName).toEqual('adminEditUserPage')
expect(pages[0].importPath).toEqual(

expect(pages.length).toEqual(7)

const adminEditUserPage = pages.find(page => page.importName === 'adminEditUserPage')
expect(adminEditUserPage).not.toBeUndefined()
expect(adminEditUserPage.importPath).toEqual(
importStatementPath(
path.join(pagesDir, 'admin/EditUserPage/EditUserPage')
)
)
expect(pages[1].importName).toEqual('BarPage')
expect(pages[1].importPath).toEqual(

const barPage = pages.find(page => page.importName === 'BarPage')
expect(barPage).not.toBeUndefined()
expect(barPage.importPath).toEqual(
importStatementPath(path.join(pagesDir, 'BarPage/BarPage'))
)
expect(pages[2].importName).toEqual('FatalErrorPage')
expect(pages[2].importPath).toEqual(
importStatementPath(
path.join(pagesDir, 'FatalErrorPage/FatalErrorPage')
)

const fatalErrorPage = pages.find(page => page.importName === 'FatalErrorPage')
expect(fatalErrorPage).not.toBeUndefined()
expect(fatalErrorPage.importPath).toEqual(
importStatementPath(path.join(pagesDir, 'FatalErrorPage/FatalErrorPage'))
)
expect(pages[3].importName).toEqual('FooPage')
expect(pages[3].importPath).toEqual(

const fooPage = pages.find(page => page.importName === 'FooPage')
expect(fooPage).not.toBeUndefined()
expect(fooPage.importPath).toEqual(
importStatementPath(path.join(pagesDir, 'FooPage/FooPage'))
)
expect(pages[4].importName).toEqual('HomePage')
expect(pages[4].importPath).toEqual(

const homePage = pages.find(page => page.importName === 'HomePage')
expect(homePage).not.toBeUndefined()
expect(homePage.importPath).toEqual(
importStatementPath(path.join(pagesDir, 'HomePage/HomePage'))
)
expect(pages[5].importName).toEqual('NotFoundPage')
expect(pages[5].importPath).toEqual(

const notFoundPage = pages.find(page => page.importName === 'NotFoundPage')
expect(notFoundPage).not.toBeUndefined()
expect(notFoundPage.importPath).toEqual(
importStatementPath(path.join(pagesDir, 'NotFoundPage/NotFoundPage'))
)
expect(pages[6].importName).toEqual('TypeScriptPage')
expect(pages[6].importPath).toEqual(
importStatementPath(
path.join(pagesDir, 'TypeScriptPage/TypeScriptPage')
)

const typeScriptPage = pages.find(page => page.importName === 'TypeScriptPage')
expect(typeScriptPage).not.toBeUndefined()
expect(typeScriptPage.importPath).toEqual(
importStatementPath(path.join(pagesDir, 'TypeScriptPage/TypeScriptPage'))
)
})
})
Expand Down

0 comments on commit 0826b7d

Please sign in to comment.