Skip to content

Commit

Permalink
test(s2s-cli): imporove coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
akameco committed Jan 21, 2018
1 parent 321980e commit 3381f6f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/s2s-cli/src/utils/index.test.js
Expand Up @@ -60,3 +60,15 @@ test('isAlreadyExist returns false when a code is empty string', () => {
expect(utils.isAlreadyExist('hoge')).toBe(false)
spyFs.mockRestore()
})

test('isAlreadyExist returns true when file is already exist', () => {
const spyFs = jest.spyOn(fs, 'readFileSync').mockReturnValue('exist')
expect(utils.isAlreadyExist('hoge')).toBe(true)
spyFs.mockRestore()
})

test('isAlreadyExist returns false when throw error', () => {
const spyFs = jest.spyOn(fs, 'readFileSync').mockReturnValue(new Error('err'))
expect(utils.isAlreadyExist('')).toBe(false)
spyFs.mockRestore()
})

0 comments on commit 3381f6f

Please sign in to comment.