mirror of
https://github.com/yannbertrand/macos-defaults
synced 2024-12-16 14:42:32 +00:00
28 lines
715 B
JavaScript
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')
|