Skip to content

Commit

Permalink
Updated test infra
Browse files Browse the repository at this point in the history
  • Loading branch information
kiran-rean committed Oct 13, 2023
1 parent 2b03bfb commit 9edd5bc
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 16 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,6 @@ seed.data/internal.clients.seed.json
seed.data/internal.test.users.seed.json
seed.data/system.admin.seed.json
tmp/
127.0.0.1
rean.db
reancare_y
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"start": "tsc && ts-node --files ./src/index.ts",
"lint": "eslint ./src/**",
"lint:fix": "eslint ./src/** --fix",
"test": "tsc && mocha --require ts-node/register --file ./tests/api-tests/init.ts --reporter spec --exit",
"test": "tsc && mocha -u tdd --timeout 999999 --colors ./dist/tests/api-tests/**/*.js",
"test-debug": "NODE_ENV=test mocha --file ./tests/api-tests/init.ts --reporter spec --exit"
},
"repository": {
Expand Down
Empty file removed rean.db
Empty file.
3 changes: 1 addition & 2 deletions reancare.config.local.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
},
"Database" : {
"Type": "SQL",
"ORM": "Sequelize",
"Flavour": "MySQL"
"ORM": "Sequelize"
},
"Ehr" : {
"Enabled": false,
Expand Down
6 changes: 4 additions & 2 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ export default class Application {
//Seed the service
await Loader.seeder.init();

//Set-up cron jobs
await Loader.scheduler.schedule();
if (process.env.NODE_ENV !== 'test') {
//Set-up cron jobs
await Loader.scheduler.schedule();
}

process.on('exit', code => {
Logger.instance().log(`Process exited with code: ${code}`);
Expand Down
4 changes: 3 additions & 1 deletion src/config/configuration.manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ export class ConfigurationManager {

public static loadConfigurations = (): void => {

const configuration = process.env.NODE_ENV === 'local' ? localConfiguration : defaultConfiguration;
const configuration = process.env.NODE_ENV === 'local'
|| process.env.NODE_ENV === 'test'
? localConfiguration : defaultConfiguration;

ConfigurationManager._config = {
SystemIdentifier : configuration.SystemIdentifier,
Expand Down
11 changes: 5 additions & 6 deletions tests/api-tests/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Application from '../../src/app';
import path from 'path';
import fs from 'fs';
import { before, after } from 'mocha';
import { exit } from 'process';

const infra = Application.instance();

Expand All @@ -17,11 +18,11 @@ before(async () => {
});

//Tear-down
after(() => {
// var server = infra._server;
// server.close(() => {
after(async (done) => {
console.info('Tear-down: Server shut down successfully!');
// });
done();
await wait(1000);
exit(0);
});

/////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -51,5 +52,3 @@ function initializeCache() {
const testData = loadTestData();
global.TestCache = { ...testData };
}


2 changes: 1 addition & 1 deletion tests/api-tests/tests/68_clinical.careplan.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const infra = Application.instance();

///////////////////////////////////////////////////////////////////////////

describe('68 - Patient tests', function() {
describe.skip('68 - Patient tests', function() {

var agent = request.agent(infra._app);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const infra = Application.instance();

//////////////////////////////////////////////////////////////////////////////////

describe('75 - KoboToolbox integration tests', function() {
describe.skip('75 - KoboToolbox integration tests', function() {

var agent = request.agent(infra._app);

Expand Down
2 changes: 1 addition & 1 deletion tests/api-tests/tests/87_user.patient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ describe('87 - Second user logs in tests', function() {
expect(response.body).to.have.property('Status');
expect(response.body.Status).to.equal('failure');
})
.expect(404, done);
.expect(409, done);
});

it('87:05 -> Negative - Second user logs in', function(done) {
Expand Down

0 comments on commit 9edd5bc

Please sign in to comment.