From 77ff19903daafa0e9beb152a86548a415f4287f5 Mon Sep 17 00:00:00 2001 From: Paul Melnikow Date: Tue, 27 Nov 2018 16:36:20 -0500 Subject: [PATCH] Test the notfound routes in server.js (#2398) --- server.spec.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/server.spec.js b/server.spec.js index 4ff4c23d53030..781e8e5011de3 100644 --- a/server.spec.js +++ b/server.spec.js @@ -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')