mirror of
https://github.com/yannbertrand/macos-defaults
synced 2024-12-15 22:22:31 +00:00
062d8b5217
Co-authored-by: Yvonnick FRIN <frin.yvonnick@gmail.com>
31 lines
867 B
JavaScript
31 lines
867 B
JavaScript
const fs = require('fs')
|
|
jest.mock('fs')
|
|
|
|
const writeInitialTree = require('./write-initial-tree')
|
|
|
|
const initialDestinationPath = './dist-initial'
|
|
const copiedFiles = ['.gitmoji-changelogrc', 'license']
|
|
|
|
describe('write-initial-tree', () => {
|
|
beforeEach(() => {
|
|
writeInitialTree(initialDestinationPath)
|
|
})
|
|
|
|
afterEach(() => {
|
|
jest.clearAllMocks()
|
|
})
|
|
|
|
it('should copy some static files', () => {
|
|
copiedFiles.forEach(file => {
|
|
const fileContent = readFile(`${initialDestinationPath}/${file}`)
|
|
expect(fileContent).toEqual(`copied:./templates/${file}`)
|
|
})
|
|
})
|
|
|
|
it('should write an empty readme.md file using the home template', () => {
|
|
const rootReadmeContent = readFile(`${initialDestinationPath}/readme.md`)
|
|
expect(rootReadmeContent).toMatchSnapshot()
|
|
})
|
|
})
|
|
|
|
const readFile = file => fs.readFakeFileSync(file, 'utf8')
|