Skip to content

Commit

Permalink
Fix Page tests on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobbe committed Jun 4, 2020
1 parent f78d5f5 commit 5406fd8
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions packages/cli/src/commands/generate/page/__tests__/page.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
global.__dirname = __dirname
import path from 'path'
import { loadGeneratorFixture } from 'src/lib/test'

import * as page from '../page'
Expand All @@ -16,28 +17,36 @@ test('returns exactly 2 files', () => {

test('creates a page component', () => {
expect(
singleWordFiles['/path/to/project/web/src/pages/HomePage/HomePage.js']
singleWordFiles[
path.normalize('/path/to/project/web/src/pages/HomePage/HomePage.js')
]
).toEqual(loadGeneratorFixture('page', 'singleWordPage.js'))
})

test('creates a page test', () => {
expect(
singleWordFiles['/path/to/project/web/src/pages/HomePage/HomePage.test.js']
singleWordFiles[
path.normalize('/path/to/project/web/src/pages/HomePage/HomePage.test.js')
]
).toEqual(loadGeneratorFixture('page', 'singleWordPage.test.js'))
})

test('creates a page component', () => {
expect(
multiWordFiles[
'/path/to/project/web/src/pages/ContactUsPage/ContactUsPage.js'
path.normalize(
'/path/to/project/web/src/pages/ContactUsPage/ContactUsPage.js'
)
]
).toEqual(loadGeneratorFixture('page', 'multiWordPage.js'))
})

test('creates a page test', () => {
expect(
multiWordFiles[
'/path/to/project/web/src/pages/ContactUsPage/ContactUsPage.test.js'
path.normalize(
'/path/to/project/web/src/pages/ContactUsPage/ContactUsPage.test.js'
)
]
).toEqual(loadGeneratorFixture('page', 'multiWordPage.test.js'))
})
Expand Down

0 comments on commit 5406fd8

Please sign in to comment.