timpla
Version:
An optimal website development experience for [server-side] web frameworks.
24 lines (21 loc) • 763 B
text/typescript
import * as path from 'path'
import * as internal from '../../gulpfile.ts/internal'
import { projectPath } from '../../gulpfile.ts/lib/projectPath'
jest.mock('../../gulpfile.ts/internal')
jest.mock('path')
describe('projectPath', () => {
it('should return the INIT_CWD when no args', () => {
const re = projectPath()
expect(re).toEqual('INIT_CWD')
})
it('should combine the supplied paths', () => {
projectPath('fake')
const spyResolve = jest.spyOn(path, 'resolve')
expect(spyResolve).toHaveBeenCalledWith('INIT_CWD', 'fake')
})
it('should filter falsy results', () => {
projectPath('fake2', undefined)
const spyResolve = jest.spyOn(path, 'resolve')
expect(spyResolve).toHaveBeenCalledWith('INIT_CWD', 'fake2')
})
})