-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import request from 'supertest'; | ||
import app from '../../app'; | ||
|
||
describe( `GET /*`, () => { | ||
it('The API root returns a 404 error', async () => request(app()) | ||
.get('/') | ||
.set('Accept', 'application/json') | ||
.expect('Content-Type', /json/) | ||
.expect(404) | ||
); | ||
|
||
it('Any URL not member of the API endpoints returns a 404 error', async () => request(app()) | ||
.get('/lorem-ipsum') | ||
.set('Accept', 'application/json') | ||
.expect('Content-Type', /json/) | ||
.expect(404) | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export default class PageNotFound { | ||
static get404Content(_req, res) { | ||
return res.status(404).send({ | ||
error: '404', | ||
message: 'Page not found.', | ||
}); | ||
} | ||
} |