File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,9 +2,10 @@ const dotenv = require('dotenv');
22const path = require ( 'path' ) ;
33
44const isDocker = process . env . DOCKER_ENV === 'true' ;
5+ const isTest = process . env . NODE_ENV === 'integration' ;
56
6- if ( ! isDocker ) {
7- const envPath = path . resolve ( __dirname , '../../. env' ) ;
7+ if ( ! isDocker && ! isTest ) {
8+ const envPath = path . resolve ( __dirname , '../.env' ) ;
89 const res = dotenv . config ( { path : envPath } ) ;
910
1011 if ( res . error ) {
@@ -23,8 +24,8 @@ const getEnv = (key) => {
2324} ;
2425
2526const OPENHIM_API_URL = getEnv ( 'OPENHIM_API_URL' ) ;
26- const OPENHIM_API_USERNAME = getEnv ( 'OPENHIM_ROOT_USERNAME ' ) ;
27- const OPENHIM_API_PASSWORD = getEnv ( 'OPENHIM_ROOT_PASSWORD ' ) ;
27+ const OPENHIM_API_USERNAME = getEnv ( 'OPENHIM_USERNAME ' ) ;
28+ const OPENHIM_API_PASSWORD = getEnv ( 'OPENHIM_PASSWORD ' ) ;
2829const OPENHIM_CLIENT_PASSWORD = getEnv ( 'OPENHIM_CLIENT_PASSWORD' ) ;
2930const OPENHIM_USER_PASSWORD = getEnv ( 'OPENHIM_USER_PASSWORD' ) ;
3031
Original file line number Diff line number Diff line change 1+ COUCHDB_USER=admin
2+ COUCHDB_PASSWORD=password
3+ OPENHIM_API_URL=https://openhim-core:8080
4+ OPENHIM_PASSWORD=openhim-password
5+ OPENHIM_USERNAME=root@openhim.org
6+ OPENHIM_CLIENT_PASSWORD=interop-password
7+ OPENHIM_USER_PASSWORD=interop-password
Original file line number Diff line number Diff line change @@ -7,21 +7,21 @@ services:
77 ports :
88 - " 6000:6000"
99 env_file :
10- - ../.env
10+ - ../mediator/ .env
1111 environment :
1212 - DOCKER_ENV=true
1313 depends_on :
1414 - configurator
1515 restart : ' unless-stopped'
1616 networks :
1717 - cht-net
18-
18+
1919 configurator :
2020 build :
2121 context : ../
2222 dockerfile : ./configurator/Dockerfile
2323 env_file :
24- - ../.env
24+ - ../configurator/ .env
2525 environment :
2626 - DOCKER_ENV=true
2727 networks :
Original file line number Diff line number Diff line change @@ -2,9 +2,10 @@ import * as dotenv from 'dotenv';
22import path from 'path' ;
33
44const isDocker = process . env . DOCKER_ENV === 'true' ;
5+ const isTest = process . env . NODE_ENV === 'integration' ;
56
6- if ( ! isDocker ) {
7- const envPath = path . resolve ( __dirname , '../../. env' ) ;
7+ if ( ! isDocker && ! isTest ) {
8+ const envPath = path . resolve ( __dirname , '../.env' ) ;
89 const res = dotenv . config ( {
910 path : envPath
1011 } ) ;
Original file line number Diff line number Diff line change 11OPENHIM_USERNAME=interop@openhim.org
22OPENHIM_PASSWORD=interop-password
33OPENHIM_API_URL=https://openhim-core:8080
4- OPENHIM_ROOT_USERNAME = root@openhim.org
5- OPENHIM_ROOT_PASSWORD = openhim-password
6- OPENHIM_USER_PASSWORD = interop-password
7- OPENHIM_CLIENT_PASSWORD = interop-password
84PORT=6000
95FHIR_URL=http://openhim-core:5001/fhir
106FHIR_USERNAME=interop-client
117FHIR_PASSWORD=interop-password
12- CHT_URL = http ://nginx
13- CHT_USERNAME = medic
8+ CHT_URL=https ://nginx
9+ CHT_USERNAME=admin
1410CHT_PASSWORD=password
Original file line number Diff line number Diff line change @@ -11,5 +11,4 @@ module.exports = {
1111 testPathIgnorePatterns : [
1212 '<rootDir>/dist/' ,
1313 ] ,
14- setupFilesAfterEnv : [ './jest.setup.ts' ] ,
1514} ;
Original file line number Diff line number Diff line change 1+ const baseConfig = require ( './jest.base.config.js' ) ;
2+
3+ module . exports = {
4+ ...baseConfig ,
5+ displayName : 'e2e' ,
6+ testMatch : [
7+ '<rootDir>/test/**/*.spec.ts' ,
8+ ] ,
9+ // Note: setupFilesAfterEnv is not included here
10+ } ;
Original file line number Diff line number Diff line change 1- import * as dotenv from 'dotenv' ;
2-
31jest . mock ( 'dotenv' , ( ) => ( {
42 config : jest . fn ( ( ) => {
53 // Set the environment variables you need for your tests
Original file line number Diff line number Diff line change 1+ const baseConfig = require ( './jest.base.config.js' ) ;
2+
3+ module . exports = {
4+ ...baseConfig ,
5+ displayName : 'unit' ,
6+ testMatch : [
7+ '<rootDir>/src/**/*.spec.ts' ,
8+ '!<rootDir>/test/**/*' ,
9+ ] ,
10+ setupFilesAfterEnv : [ './jest.setup.ts' ] ,
11+ } ;
Original file line number Diff line number Diff line change 1111 "test:watch" : " jest --watch" ,
1212 "coverage" : " jest --coverage" ,
1313 "clean" : " rm -rf ./dist" ,
14- "unit-test" : " jest src/ " ,
14+ "unit-test" : " jest --config ./jest.unit.config.js " ,
1515 "e2e-test" : " test/e2e-test.sh"
1616 },
1717 "repository" : {
You can’t perform that action at this time.
0 commit comments