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')
  })
})
