Skip to content

Commit 0cfc3ae

Browse files
committed
chore(apr25): update cypress tests to check error route
1 parent 1449310 commit 0cfc3ae

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
describe('default mock error endpoint works as expected', () => {
2+
it('checks default error endpoint is running', () => {
3+
cy.request({ url: '/api/error', failOnStatusCode: false }).then(
4+
(response) => {
5+
expect(response.status).to.eq(404);
6+
expect(response.body).to.be.jsonSchema({
7+
error: '404: Not Found',
8+
});
9+
},
10+
);
11+
});
12+
13+
it('checks default error endpoint is running', () => {
14+
cy.request({
15+
url: '/api/error?status=500&message=Internal%20Server%20Error',
16+
failOnStatusCode: false,
17+
}).then((response) => {
18+
expect(response.status).to.eq(500);
19+
expect(response.body).to.be.jsonSchema({
20+
error: '500: Internal Server Error',
21+
});
22+
});
23+
});
24+
});

cypress/e2e/server-page-spec.cy.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ describe('Server page contains expected information', () => {
1010
'/api/posts',
1111
'/api/users',
1212
'/api/videos',
13+
'/api/error',
1314
];
1415
cy.visit('/');
1516
cy.get('h1').contains('Running');

0 commit comments

Comments
 (0)