Skip to content

Commit

Permalink
Add test for new throw option
Browse files Browse the repository at this point in the history
  • Loading branch information
iwatakeshi committed Nov 22, 2019
1 parent e346405 commit 71f7e2b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/utils/__test__/fetch.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,17 @@ describe('utils/fetch (no cache)', () => {
expect(existsSync(path)).toBe(true)
})

it('should throw an error when a repo is not found', async () => {
it('should return an empty string when a repo is not found', async () => {
expect.assertions(1)
expect(await fetch('github:doesnotexist123xyz/gittar#v0.1.1')).toEqual('')
})

it('should throw an error when a repo is not found (with options', async () => {
expect.assertions(1)
try {
await fetch('github:doesnotexist123xyz/gittar#v0.1.1')
await fetch('github:doesnotexist123xyz/gittar#v0.1.1', {
throw: true
})
} catch (error) {
expect(error).toBeInstanceOf(GitlyDownloadError)
}
Expand Down

0 comments on commit 71f7e2b

Please sign in to comment.