Skip to content

Commit

Permalink
Test the notfound routes in server.js (#2398)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmelnikow authored Nov 27, 2018
1 parent c678ca2 commit 77ff199
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions server.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,21 @@ describe('The server', function() {
.and.to.include('apple')
})

it('should return the 404 badge for unknown badges', async function() {
const res = await fetch(`${baseUri}/this/is/not/a/badge.svg`)
expect(res.status).to.equal(404)
expect(await res.text())
.to.satisfy(isSvg)
.and.to.include('404')
.and.to.include('badge not found')
})

it('should return the 404 html page for rando links', async function() {
const res = await fetch(`${baseUri}/this/is/most/definitely/not/a/badge.js`)
expect(res.status).to.equal(404)
expect(await res.text()).to.include('blood, toil, tears and sweat')
})

context('with svg2img error', function() {
const expectedError = fs.readFileSync(
path.resolve(__dirname, 'public', '500.html')
Expand Down

0 comments on commit 77ff199

Please sign in to comment.