blob: c8edf4d968a0f2df060987c5f9bb05dafc2ca62f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
const t = require('tap')
const fileExists = require('../../../lib/utils/file-exists.js')
t.test('returns true when arg is a file', async (t) => {
const path = t.testdir({
foo: 'just some file',
})
const result = await fileExists(`${path}/foo`)
t.equal(result, true, 'file exists')
t.end()
})
t.test('returns false when arg is not a file', async (t) => {
const path = t.testdir({
foo: {},
})
const result = await fileExists(`${path}/foo`)
t.equal(result, false, 'file does not exist')
t.end()
})
t.test('returns false when arg does not exist', async (t) => {
const path = t.testdir()
const result = await fileExists(`${path}/foo`)
t.equal(result, false, 'file does not exist')
t.end()
})
|