From c6f617e90cf61c5b3371f433fb63aa94a80fdaed Mon Sep 17 00:00:00 2001 From: yldrmzffr Date: Mon, 17 Jul 2023 21:19:21 +0300 Subject: [PATCH] test: new Exceptions Tests --- test/methods.test.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/test/methods.test.ts b/test/methods.test.ts index 2c7c30c..def2fb9 100644 --- a/test/methods.test.ts +++ b/test/methods.test.ts @@ -71,7 +71,15 @@ describe('MuzuServer', () => { it('should return 404 on GET /api/hello/world', async () => { const res = await request(muzuServer.server).get('/api/hello/world'); expect(res.status).toEqual(404); - expect(res.body).toEqual({message: '404 Not Found'}); + expect(res.body).toEqual({ + kind: 'MuzuException', + message: 'Route GET /api/hello/world not found', + status: 404, + details: { + method: 'GET', + path: '/api/hello/world', + }, + }); }); it('should return 400 on POST /api/hello', async () => { @@ -79,7 +87,11 @@ describe('MuzuServer', () => { .post('/api/hello') .send('Not a JSON'); expect(res.status).toEqual(400); - expect(res.body).toEqual({message: '400 Bad Request'}); + expect(res.body).toEqual({ + kind: 'MuzuException', + message: 'Error parsing body', + status: 400, + }); }); });