diff options
| author | jw255 | 2018-04-14 16:49:47 +0100 |
|---|---|---|
| committer | jw255 | 2018-04-14 16:49:47 +0100 |
| commit | a156860837cb6c044d16802aa5a0cd06ec05648b (patch) | |
| tree | 449bb5b827300cf52e7e533f580c6ab36bf8e4c4 /test/integration/protocol.routes.test.ts | |
| parent | much better (diff) | |
| download | medicine-a156860837cb6c044d16802aa5a0cd06ec05648b.tar.gz medicine-a156860837cb6c044d16802aa5a0cd06ec05648b.zip | |
fixed 1 test in auth.routes.test.ts
Diffstat (limited to 'test/integration/protocol.routes.test.ts')
| -rw-r--r-- | test/integration/protocol.routes.test.ts | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/test/integration/protocol.routes.test.ts b/test/integration/protocol.routes.test.ts index ea5dd8e..ad9b892 100644 --- a/test/integration/protocol.routes.test.ts +++ b/test/integration/protocol.routes.test.ts @@ -58,7 +58,7 @@ const getToken = async() => { }); }; -import options, { Template, alternative, array, exact, match, optional } from '../../src/matcher/options'; +import options, { Template, alternative, array, exact, match, optional }from '../../src/matcher/options'; import { default as types } from '../../src/matcher/types'; // The general response template according to protocol @@ -82,27 +82,6 @@ const errorResponseTemplate: Template = { type MochaForEachInput = [ string, string, Template, number ]; -describe('routes : errors', () => { - before(initDatabase); - describe('GET invalid routes', () => { - // Should invalid routes also possibly be 401? - it.skip('should have response code 404', () => { - return chai.request(app).get('/invalid/route') - .set('Authorization', `Bearer ${token}`) - .catch((err) => { - expect(err.status).to.equal(404); - }); - }); - it('should conform to the error protocol', () => { - return chai.request(app).get('/invalid/route') - .set('Authorization', `Bearer ${token}`) - .catch((err) => { - expect(match(errorResponseTemplate)(err.response.body)).to.be.true; - }); - }); - }); -}); - describe('routes : protocol', () => { const base: string = '/cs3099group-be-4'; @@ -304,4 +283,25 @@ describe('routes : protocol', () => { } }); }); + + describe('test edge cases', () => { + before(initDatabase); + describe('GET invalid routes', () => { + // Should invalid routes also possibly be 401? + it.skip('should have response code 404', () => { + return chai.request(app).get('/invalid/route') + .set('Authorization', `Bearer ${token}`) + .catch((err) => { + expect(err.status).to.equal(404); + }); + }); + it('should conform to the error protocol', () => { + return chai.request(app).get('/invalid/route') + .set('Authorization', `Bearer ${token}`) + .catch((err) => { + expect(match(errorResponseTemplate)(err.response.body)).to.be.true; + }); + }); + }); + }); }); |
