mirror of
https://github.com/theoludwig/html-w3c-validator.git
synced 2025-05-21 23:21:29 +02:00
feat: usage of ESM modules imports (instead of CommonJS)
This commit is contained in:
@ -1,29 +1,24 @@
|
||||
import fsMock from 'mock-fs'
|
||||
import tap from 'tap'
|
||||
|
||||
import { isExistingPath } from '../isExistingPath.js'
|
||||
|
||||
describe('utils/isExistingFile', () => {
|
||||
afterEach(() => {
|
||||
await tap.test('utils/isExistingPath', async (t) => {
|
||||
t.afterEach(() => {
|
||||
fsMock.restore()
|
||||
})
|
||||
|
||||
it('should return true if the file exists', async () => {
|
||||
fsMock(
|
||||
{
|
||||
'/file.txt': ''
|
||||
},
|
||||
{ createCwd: false }
|
||||
)
|
||||
expect(await isExistingPath('/file.txt')).toBeTruthy()
|
||||
await t.test('should return true if the file exists', async () => {
|
||||
fsMock({
|
||||
'/file.txt': ''
|
||||
})
|
||||
t.equal(await isExistingPath('/file.txt'), true)
|
||||
})
|
||||
|
||||
it("should return false if the file doesn't exists", async () => {
|
||||
fsMock(
|
||||
{
|
||||
'/file.txt': ''
|
||||
},
|
||||
{ createCwd: false }
|
||||
)
|
||||
expect(await isExistingPath('/randomfile.txt')).toBeFalsy()
|
||||
await t.test("should return false if the file doesn't exists", async () => {
|
||||
fsMock({
|
||||
'/file.txt': ''
|
||||
})
|
||||
t.equal(await isExistingPath('/randomfile.txt'), false)
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user