Skip to content

Commit 423511c

Browse files
committed
add another 404 test (cov 86%)
1 parent ed316b1 commit 423511c

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class Updates {
4646
const url = `https://api.github.com/repos/${account}/${repository}/releases?per_page=100`
4747
const headers = { Accept: 'application/vnd.github.preview' }
4848
const res = await fetch(url, { headers })
49+
if (res.status >= 400) return
4950
const releases = await res.json()
5051
const latest = {}
5152
for (const release of releases) {

test/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,13 @@ test('Updates', async t => {
2727
t.ok(body.name)
2828
t.match(body.url, /-mac\.zip$/)
2929

30+
// exists but has no releases
3031
res = await fetch(`${address}/juliangruber/brace-expansion/darwin/0.0.0`)
3132
t.equal(res.status, 404)
3233

34+
// doesn't exist
35+
res = await fetch(`${address}/doesnot/exist-123123123/darwin/0.0.0`)
36+
t.equal(res.status, 404)
37+
3338
server.close()
3439
})

0 commit comments

Comments
 (0)