timpla
Version:
An optimal website development experience for [server-side] web frameworks.
30 lines (26 loc) • 1.06 kB
text/typescript
jest.mock('../../gulpfile.ts/internal')
const mockReplace = jest.fn()
jest.mock('gulp-replace', () => mockReplace)
jest.mock('gulp')
jest.mock('fancy-log')
jest.mock('chalk')
const cb = jest.fn()
import * as gulp from 'gulp'
import * as internal from '../../gulpfile.ts/internal'
import { TIMPLA_DEFAULTS } from '../../gulpfile.ts/lib/TIMPLA_DEFAULTS'
import { initConfig as initConfigTask } from '../../gulpfile.ts/tasks/initConfig'
import { clone } from '../helpers'
describe('initConfigTask', () => {
it('should initialise the config', () => {
const conf = clone(TIMPLA_DEFAULTS)
const initConfig = initConfigTask(conf)
const spyGulpSrc = jest.spyOn(gulp, 'src')
const spyGulpDest = jest.spyOn(gulp, 'dest')
const spyProjectPath = jest.spyOn(internal, 'projectPath')
spyProjectPath.mockReturnValue('hello')
initConfig(cb)
expect(spyGulpSrc).toHaveBeenCalledWith(['.timplaconfig.js'])
expect(spyGulpDest).toHaveBeenCalledWith('hello')
expect(mockReplace).toHaveBeenCalledWith('./lib/public', 'timpla')
})
})