From a7567c50bbf01e3a8489d732d2825fa01921f2d3 Mon Sep 17 00:00:00 2001 From: jw255 Date: Fri, 13 Apr 2018 16:35:50 +0100 Subject: got it down to 34 errors in the protocol --- test/integration/protocol.routes.test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/integration/protocol.routes.test.ts b/test/integration/protocol.routes.test.ts index ca20da9..2a7cf54 100644 --- a/test/integration/protocol.routes.test.ts +++ b/test/integration/protocol.routes.test.ts @@ -170,7 +170,7 @@ describe('routes : protocol', () => { private_user_metadata: types.anything, public_admin_metadata: types.anything, private_admin_metadata: types.anything - }), 401], + }), 200], // TODO types.metadata ['get', '/users/mock_user', { username: types.string, @@ -183,11 +183,11 @@ describe('routes : protocol', () => { private_user_metadata: types.anything, public_admin_metadata: types.anything, private_admin_metadata: types.anything - }, 401], - ['post', '/users/mock_user', null, 401], + }, 200], + ['post', '/users/mock_user', null, 200], ['get', '/users/mock_user/properties', { data: optional(types.anything) - }, 401], + }, 200], ['get', '/current_user', { username: types.string, privileges: array(types.string), -- cgit v1.2.1 From c9a574ec946dc7fda6637db45f3223acd0a08e9f Mon Sep 17 00:00:00 2001 From: jw255 Date: Fri, 13 Apr 2018 16:45:32 +0100 Subject: fixed user not found --- test/integration/protocol.routes.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/integration/protocol.routes.test.ts b/test/integration/protocol.routes.test.ts index 2a7cf54..866ac2a 100644 --- a/test/integration/protocol.routes.test.ts +++ b/test/integration/protocol.routes.test.ts @@ -184,7 +184,7 @@ describe('routes : protocol', () => { public_admin_metadata: types.anything, private_admin_metadata: types.anything }, 200], - ['post', '/users/mock_user', null, 200], + ['post', '/users/new_user', null, 200], ['get', '/users/mock_user/properties', { data: optional(types.anything) }, 200], -- cgit v1.2.1 From 74b2aeed25fbf4c8bcb4d4ae34044e3d1705db0e Mon Sep 17 00:00:00 2001 From: jw255 Date: Fri, 13 Apr 2018 16:58:06 +0100 Subject: fixed template matching in test suite --- test/integration/protocol.routes.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/integration/protocol.routes.test.ts b/test/integration/protocol.routes.test.ts index 866ac2a..ebe18c2 100644 --- a/test/integration/protocol.routes.test.ts +++ b/test/integration/protocol.routes.test.ts @@ -266,14 +266,14 @@ describe('routes : protocol', () => { }); }); forEach(completeProtocol).it( - '%s %s should conform to the general response protocol', + '%s %s should conform to the general response template', (method: string, path: string, temp: Template, resCode: number) => { const request: ChaiHttp.Request = method === 'get' ? chai.request(app).get(base + path) : chai.request(app).post(base + path); request.set('Authorization', `Bearer ${token}`); return request.then((res: ChaiHttp.Response) => { - match(responseTemplate, JSON.parse(res.body)).shoul.be.true; + expect(match(responseTemplate)(res.body)).to.be.true; }); }); forEach(completeProtocol).it( @@ -284,7 +284,7 @@ describe('routes : protocol', () => { .get(base + path) .set('Authorization', `Bearer ${token}`) .then((res: ChaiHttp.Response) => { - expect(match(temp)(JSON.parse(res.body))).to.be.true; + expect(match(temp)(res.body)).to.be.true; }); } else { return true; -- cgit v1.2.1