Skip to content

Commit

Permalink
test: add tests for isDirectoryExisting
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-D committed May 21, 2023
1 parent befabdf commit ec6c34a
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/functions/isDirectoryExisting.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import test from 'ava'

import isDirectoryExisting from '@/src/functions/isDirectoryExisting'
import mockDependencies from '@/test/__helpers__/mockDependencies'


test('directory exists', async t => {
const dependencies = mockDependencies({
fsAccess: async () => Promise.resolve(),
})

t.is(await isDirectoryExisting('/exists', dependencies), true)
})

test('directory does not exists', async t => {
const dependencies = mockDependencies({
fsAccess: async () => Promise.reject(new Error('File does not exists')),
})

t.is(await isDirectoryExisting('/does-not-exists', dependencies), false)
})

0 comments on commit ec6c34a

Please sign in to comment.