mirror of
https://github.com/theoludwig/html-w3c-validator.git
synced 2024-12-08 00:45:37 +01:00
30 lines
617 B
TypeScript
30 lines
617 B
TypeScript
|
import fsMock from 'mock-fs'
|
||
|
|
||
|
import { isExistingPath } from '../isExistingPath.js'
|
||
|
|
||
|
describe('utils/isExistingFile', () => {
|
||
|
afterEach(async () => {
|
||
|
fsMock.restore()
|
||
|
})
|
||
|
|
||
|
it('should return true if the file exists', async () => {
|
||
|
fsMock(
|
||
|
{
|
||
|
'/file.txt': ''
|
||
|
},
|
||
|
{ createCwd: false }
|
||
|
)
|
||
|
expect(await isExistingPath('/file.txt')).toBeTruthy()
|
||
|
})
|
||
|
|
||
|
it("should return false if the file doesn't exists", async () => {
|
||
|
fsMock(
|
||
|
{
|
||
|
'/file.txt': ''
|
||
|
},
|
||
|
{ createCwd: false }
|
||
|
)
|
||
|
expect(await isExistingPath('/randomfile.txt')).toBeFalsy()
|
||
|
})
|
||
|
})
|