macos-defaults/build/github/write-config.test.js
Yann Bertrand a6a996ddd2 🚨 Run Prettier
2020-11-27 14:39:16 +01:00

28 lines
715 B
JavaScript

const fs = require('fs')
jest.mock('fs')
const writeConfig = require('./write-config')
const templatesPath = 'templates'
const destinationPath = 'dist'
const copiedFiles = ['.gitmoji-changelogrc', 'license']
describe('write-config', () => {
afterEach(() => {
jest.clearAllMocks()
})
beforeEach(() => {
callWriteConfig()
})
it('should copy some static files', () => {
copiedFiles.forEach((file) => {
const fileContent = readFile(`${destinationPath}/${file}`)
expect(fileContent).toEqual(`copied:${templatesPath}/${file}`)
})
})
})
const callWriteConfig = () => writeConfig({}, templatesPath, destinationPath)
const readFile = (file) => fs.readFakeFileSync(file, 'utf8')