fs-cache-fast/test/helper.mjs
2024-09-20 23:18:10 +00:00

27 lines
475 B
JavaScript

import { spy } from 'eltro'
export function fakeFsSync() {
return {
mkdirSync: spy(),
readFileSync: spy(),
writeFileSync: spy(),
rmSync: spy(),
readdirSync: spy(),
}
}
export function fakeFsPromises() {
return {
readFile: spy().resolves(),
writeFile: spy().resolves(),
rm: spy().resolves(),
readdir: spy().resolves([]),
}
}
export function fakeFs() {
return {
fsSync: fakeFsSync(),
fsPromises: fakeFsPromises(),
}
}