aboutsummaryrefslogtreecommitdiff
path: root/test/integration
diff options
context:
space:
mode:
authorTom Harley2018-04-13 16:21:46 +0100
committerTom Harley2018-04-13 16:21:46 +0100
commit1905365083dc63d06de2a169c18163f4b04e231d (patch)
tree10ee91cbdb921a2f8c74291eeecca9cae9c9c7ec /test/integration
parentFix minor places, and add Postman collection (diff)
parentMerge branch 'trh/gets' of https://gitlab.cs.st-andrews.ac.uk/cs3099group-be-... (diff)
downloadmedicine-1905365083dc63d06de2a169c18163f4b04e231d.tar.gz
medicine-1905365083dc63d06de2a169c18163f4b04e231d.zip

Merge branch ‘trh/gets’ of gitlab.cs.st-andrews.ac.uk:cs3099group-be-4/project-code into trh/gets

Diffstat (limited to 'test/integration')
-rw-r--r--test/integration/protocol.routes.test.ts26
1 files changed, 21 insertions, 5 deletions
diff --git a/test/integration/protocol.routes.test.ts b/test/integration/protocol.routes.test.ts
index 6a08278..1c80fb2 100644
--- a/test/integration/protocol.routes.test.ts
+++ b/test/integration/protocol.routes.test.ts
@@ -8,7 +8,7 @@
import * as chai from 'chai';
const expect: Chai.ExpectStatic = chai.expect;
import { Credentials, Database, addUser, initDB, resetDB,
- Projec, addProjec } from '../test-db';
+ Projec, addProjec, Filee, addFilee } from '../test-db';
import { default as User } from '../../src/db/model/User';
// Chai-http must be imported this way:
@@ -30,6 +30,7 @@ let database: Database;
let mockUser: Credentials;
let token: string;
let mockProj: Projec;
+let mockFile: Filee;
const initDatabase = async() => {
database = initDB();
@@ -40,6 +41,7 @@ const populateDatabase = async() => {
await resetDB(database);
mockUser = await addUser(database, true);
mockProj = await addProjec(database, mockUser);
+ mockFile = await addFilee(database, mockUser);
};
const getToken = async() => {
@@ -228,9 +230,9 @@ describe('routes : protocol', () => {
['get', '/projects/mocky/properties', {
data: optional(types.anything)
}, 200],
- ['get', '/projects/mocky/files/:path', null, 200],
- ['post', '/projects/mocky/files/:id', null, 200],
- ['get', '/projects/mocky/files_by_id/:id', null, 200]
+ ['get', '/projects/mocky/files/example/path', null, 200],
+ ['post', '/projects/mocky/files/mockyfile2', null, 200],
+ ['get', '/projects/mocky/files_by_id/file1', null, 200]
];
/* tslint:enable:align */
@@ -239,8 +241,22 @@ describe('routes : protocol', () => {
beforeEach(populateDatabase);
beforeEach(getToken);
+ it('test log', () => {
+ return chai.request(app).get(base + '/log')
+ .set('Authorization', `Bearer ${token}`)
+ .catch((err) => {
+ console.log("a")
+ console.log(err.response.body)
+ expect(false);
+ }).then((res: ChaiHttp.Response) => {
+ console.log("b")
+ console.log(res.body)
+ expect(false);
+ });
+ });
+
describe('Access all valid routes', () => {
- forEach(completeProtocol).it.only(
+ forEach(completeProtocol).it(
'%s %s should be json',
(method: string, path: string, temp: Template, resCode: number) => {
const request: ChaiHttp.Request = method === 'get'