Skip to content

Commit

Permalink
Merge pull request #16 from Sleavely/fs-tests--windows-compatibility
Browse files Browse the repository at this point in the history
Windows compatibility for fs tests
  • Loading branch information
Sleavely authored May 10, 2020
2 parents e609c4c + 336927f commit 0df5f18
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/utils/fs.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const fs = require('fs')
const path = require('path')

jest.mock('fs')
jest.mock('util', () => ({
Expand Down Expand Up @@ -90,7 +91,7 @@ describe('findUpwardsFile()', () => {
const targetFile = await findUpwardsFile(filename, directory)

expect(fs.access).toHaveBeenCalledTimes(1)
expect(targetFile).toBe('/home/test/test.file')
expect(targetFile).toBe(path.normalize('/home/test/test.file'))
})
it('defaults to process.cwd()', async () => {
const { findUpwardsFile } = jest.requireActual('./fs')
Expand All @@ -113,7 +114,7 @@ describe('findUpwardsFile()', () => {

const targetFile = await findUpwardsFile(filename, directory)

expect(targetFile).toBe('/home/test/test.file')
expect(targetFile).toBe(path.normalize('/home/test/test.file'))
})
it('returns false when file cannot be found', async () => {
const { findUpwardsFile } = jest.requireActual('./fs')
Expand Down

0 comments on commit 0df5f18

Please sign in to comment.