2024-09-20 13:40:01 +00:00
|
|
|
import { spy } from 'eltro'
|
|
|
|
|
|
|
|
export function fakeFsSync() {
|
|
|
|
return {
|
|
|
|
mkdirSync: spy(),
|
|
|
|
readFileSync: spy(),
|
|
|
|
writeFileSync: spy(),
|
2024-09-20 23:14:22 +00:00
|
|
|
rmSync: spy(),
|
|
|
|
readdirSync: spy(),
|
2024-09-20 13:40:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export function fakeFsPromises() {
|
|
|
|
return {
|
|
|
|
readFile: spy().resolves(),
|
|
|
|
writeFile: spy().resolves(),
|
2024-09-20 23:14:22 +00:00
|
|
|
rm: spy().resolves(),
|
|
|
|
readdir: spy().resolves([]),
|
2024-09-20 13:40:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export function fakeFs() {
|
|
|
|
return {
|
|
|
|
fsSync: fakeFsSync(),
|
|
|
|
fsPromises: fakeFsPromises(),
|
|
|
|
}
|
|
|
|
}
|