mirror of
https://github.com/hanzoai/lint-staged.git
synced 2026-10-30 19:37:36 +00:00
24 lines
797 B
JavaScript
24 lines
797 B
JavaScript
import { describe, it } from 'vitest'
|
|
|
|
import { readFile, unlink } from '../../lib/file.js'
|
|
|
|
describe('unlink', () => {
|
|
it('should not throw by default when file is not found', async ({ expect }) => {
|
|
await expect(unlink('example')).resolves.toBeUndefined()
|
|
})
|
|
|
|
it('should throw when second argument is false and file is not found', async ({ expect }) => {
|
|
await expect(unlink('example', false)).rejects.toThrow('ENOENT')
|
|
})
|
|
})
|
|
|
|
describe('readFile', () => {
|
|
it('should not throw by default when file is not found', async ({ expect }) => {
|
|
await expect(readFile('example')).resolves.toBeNull()
|
|
})
|
|
|
|
it('should throw when second argument is false and file is not found', async ({ expect }) => {
|
|
await expect(readFile('example', false)).rejects.toThrow('ENOENT')
|
|
})
|
|
})
|