macos-defaults/build/production/__mocks__/fs.js
Yann Bertrand a6a996ddd2 🚨 Run Prettier
2020-11-27 14:39:16 +01:00

15 lines
391 B
JavaScript

const fs = jest.genMockFromModule('fs')
const result = {}
fs.mkdirSync = jest.fn()
fs.writeFileSync = jest.fn((path, content) => {
result[path] = content
})
fs.copyFileSync = jest.fn((origin, destination) => {
result[destination] = `copied:${origin}`
})
fs.readFakeFileSync = jest.fn((path) => result[path])
fs.readFileSync = jest.requireActual('fs').readFileSync
module.exports = fs