aboutsummaryrefslogtreecommitdiff
path: root/test/integration
diff options
context:
space:
mode:
authorjw2552018-03-03 16:18:01 +0000
committerjw2552018-03-03 16:18:01 +0000
commit407a5a3c6c1d6d4c170d7646f921bb6f2fb2f380 (patch)
tree75fb490f319f9bab9bdbd3445ca2eb9a3768745d /test/integration
parentpulled latest files from trh/payload-checker (diff)
downloadmedicine-407a5a3c6c1d6d4c170d7646f921bb6f2fb2f380.tar.gz
medicine-407a5a3c6c1d6d4c170d7646f921bb6f2fb2f380.zip

now compiles. also added stubs for database testing

Diffstat (limited to 'test/integration')
-rw-r--r--test/integration/protocol.routes.test.ts16
1 files changed, 13 insertions, 3 deletions
diff --git a/test/integration/protocol.routes.test.ts b/test/integration/protocol.routes.test.ts
index 808fe50..e60cd81 100644
--- a/test/integration/protocol.routes.test.ts
+++ b/test/integration/protocol.routes.test.ts
@@ -13,6 +13,16 @@ import { default as types } from '../../src/matcher/types';
import * as App from '../../src/app';
let app = App.TestApp();
+// The general response template according to protocol
+const responseTemplate: Template = {
+ status: types.string,
+ data: optional(types.anything),
+ error: optional(types.string),
+ error_description: optional(types.string),
+ user_message: optional(types.string),
+ error_data: optional(types.anything)
+};
+
// The error response template according to protocol
const errorResponseTemplate: Template = {
status: 'error',
@@ -36,8 +46,8 @@ before(function(done){
authenticatedUser
.post('/login')
.send(userCredentials)
- .end(function(err, response){
- expect(response.statusCode).to.equal(200);
+ .end(function(err, res){
+ expect(res.status).to.equal(200);
done();
});
});
@@ -199,7 +209,7 @@ describe('routes : protocol', () => {
});;
});
forEach(completeProtocol).it(
- '%s %s should have a status %d',
+ '%s %s should have a status %4$d',
(method: string, path: string, temp: Template, res_code: number) => {
const request: ChaiHttp.Request = method === 'get'
? chai.request(app).get(base + path)