Skip to content

Commit

Permalink
Add test for createFile
Browse files Browse the repository at this point in the history
  • Loading branch information
lukechilds committed Jun 20, 2019
1 parent fa576e8 commit 2d17ed5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/ensure/__tests__/create.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@ describe('fs-extra', () => {
done()
})
})

it('should give clear error if node in directory tree is a file', done => {
const existingFile = path.join(TEST_DIR, Math.random() + 'ts-e', Math.random() + '.txt')
fse.mkdirsSync(path.dirname(existingFile))
fs.writeFileSync(existingFile)

const file = path.join(existingFile, Math.random() + '.txt')
fse.createFile(file, err => {
assert.strictEqual(err.code, 'ENOTDIR')
done()
})
})
})
})

Expand Down

0 comments on commit 2d17ed5

Please sign in to comment.