diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/integration/protocol.routes.test.ts | 16 | ||||
| -rw-r--r-- | test/unit/database.unit.test.ts | 63 |
2 files changed, 76 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) diff --git a/test/unit/database.unit.test.ts b/test/unit/database.unit.test.ts new file mode 100644 index 0000000..a746cd0 --- /dev/null +++ b/test/unit/database.unit.test.ts @@ -0,0 +1,63 @@ +import * as chai from 'chai'; +chai.should(); + +const sample_project:any = null; +const sample_user:any = null; +const sample_file:any = null; + +// tslint:disable-next-line:no-require-imports +describe('database:', () => { + describe('SQL Model', () => { + // before each test initialise the database + let database; + beforeEach(function() { + // import database + }); + + context('initialisation', () => { + it('should complete successfully', () => { + // check no errors were thrown on import / answers to ping + }); + it('should recreate schema', () => { + // check all tables and functions are present according to some schema + }); + it('should be empty', () => { + // check projects, users, etc tables are empty + }); + it('should have initial admin user', () => { + // check admin user exists + }); + }); + context('usage', () => { + context('users', () => { + it('should be possible to add users', () => { + // add sample user and check no error was thrown + }); + it('should be possible to retreive users', () => { + // add sample user and retreive user, then compare username, uuid, etc + }); + }); + context('projects', () => { + it('should be possible to add projects', () => { + // add sample project and check no error was thrown + }); + it('should be possible to retreive projects', () => { + // add sample project and retreive project, then compare properties + }); + }); + context('files', () => { + it('should be possible to add files', () => { + // add sample file and check no error was thrown + }); + it('should be possible to retreive files', () => { + // add sample file and retreive file, then compare properties + }); + }); + // to be expanded + }); + // to be expaned + }); + describe('ORM Model', () => { + // to be expanded + }); +});
\ No newline at end of file |
