Injects Google Analytics tag via environment variable. Prevents gtag race condition from sporadically causing failing unit tests
This commit is contained in:
parent
431973f2b9
commit
29339c5709
|
@ -12299,9 +12299,9 @@
|
|||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||
},
|
||||
"sartography-workflow-lib": {
|
||||
"version": "0.0.247",
|
||||
"resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.247.tgz",
|
||||
"integrity": "sha512-JAt+GC/I3C+mGPNJ+n2eCjVjXcCRQ9UZQmUQTeaHKXacfhb3AK1aM0qAYA+UCQgZiZaPeTH5hJRkbQOJD5aKfg=="
|
||||
"version": "0.0.248",
|
||||
"resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.248.tgz",
|
||||
"integrity": "sha512-zajKeap3wRa1dhG+pB+MFHvu0v8DgsvB4G0Q27fsPM8uuNEuvglf2w583KITe9SpNbqMCraFj5vGXAcAiiJNmw=="
|
||||
},
|
||||
"sass": {
|
||||
"version": "1.23.3",
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
"ngx-file-drop": "^8.0.8",
|
||||
"ngx-markdown": "^9.0.0",
|
||||
"rxjs": "~6.5.4",
|
||||
"sartography-workflow-lib": "0.0.247",
|
||||
"sartography-workflow-lib": "0.0.248",
|
||||
"tslib": "^1.11.1",
|
||||
"uuid": "^7.0.2",
|
||||
"zone.js": "^0.10.3"
|
||||
|
|
|
@ -10,5 +10,5 @@ export const environment: AppEnvironment = {
|
|||
api: _has(ENV, 'api', '$API_URL') ? ENV.api : 'http://localhost:5000/v1.0',
|
||||
irbUrl: _has(ENV, 'irbUrl', '$IRB_URL') ? ENV.irbUrl : 'http://localhost:5001',
|
||||
title: _has(ENV, 'title', '$TITLE') ? ENV.title : 'Research Ramp-Up Toolkit Configurator',
|
||||
googleAnalyticsKey: _has(ENV, 'googleAnalyticsKey', '$GOOGLE_ANALYTICS_KEY') ? ENV.title : 'UA-168203235-5',
|
||||
googleAnalyticsKey: _has(ENV, 'googleAnalyticsKey', '$GOOGLE_ANALYTICS_KEY') ? ENV.googleAnalyticsKey : 'UA-168203235-5',
|
||||
};
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import {AppEnvironment} from 'sartography-workflow-lib';
|
||||
import {_has, environment} from './environment.runtime';
|
||||
|
||||
declare var ENV;
|
||||
|
@ -10,6 +9,8 @@ describe('Environments', () => {
|
|||
expect(environment.api).toEqual('apiRoot');
|
||||
expect(environment.irbUrl).toEqual('irbUrl');
|
||||
expect(environment.homeRoute).toEqual('home');
|
||||
expect(environment.title).toEqual('Research Ramp-Up Toolkit Configurator');
|
||||
expect(environment.googleAnalyticsKey).toEqual('UA-168203235-5');
|
||||
});
|
||||
|
||||
it('should check if environment variables are defined', () => {
|
||||
|
@ -18,31 +19,43 @@ describe('Environments', () => {
|
|||
production: '$PRODUCTION',
|
||||
api: '$API_URL',
|
||||
irbUrl: '$IRB_URL',
|
||||
title: '$TITLE',
|
||||
googleAnalyticsKey: '$GOOGLE_ANALYTICS_KEY',
|
||||
};
|
||||
|
||||
expect(_has(env, 'homeRoute', '$HOME_ROUTE')).toBeFalse();
|
||||
expect(_has(env, 'production', '$PRODUCTION')).toBeFalse();
|
||||
expect(_has(env, 'api', '$API_URL')).toBeFalse();
|
||||
expect(_has(env, 'irbUrl', '$IRB_URL')).toBeFalse();
|
||||
expect(_has(env, 'title', '$TITLE')).toBeFalse();
|
||||
expect(_has(env, 'googleAnalyticsKey', '$GOOGLE_ANALYTICS_KEY')).toBeFalse();
|
||||
|
||||
env.homeRoute = undefined;
|
||||
env.production = undefined;
|
||||
env.api = undefined;
|
||||
env.irbUrl = undefined;
|
||||
env.title = undefined;
|
||||
env.googleAnalyticsKey = undefined;
|
||||
|
||||
expect(_has(env, 'homeRoute', '$HOME_ROUTE')).toBeFalse();
|
||||
expect(_has(env, 'production', '$PRODUCTION')).toBeFalse();
|
||||
expect(_has(env, 'api', '$API_URL')).toBeFalse();
|
||||
expect(_has(env, 'irbUrl', '$IRB_URL')).toBeFalse();
|
||||
expect(_has(env, 'title', '$TITLE')).toBeFalse();
|
||||
expect(_has(env, 'googleAnalyticsKey', '$GOOGLE_ANALYTICS_KEY')).toBeFalse();
|
||||
|
||||
env.homeRoute = 'something';
|
||||
env.production = 'something';
|
||||
env.api = 'something';
|
||||
env.irbUrl = 'something';
|
||||
env.title = 'something';
|
||||
env.googleAnalyticsKey = 'something';
|
||||
|
||||
expect(_has(env, 'homeRoute', '$HOME_ROUTE')).toBeTrue();
|
||||
expect(_has(env, 'production', '$PRODUCTION')).toBeTrue();
|
||||
expect(_has(env, 'api', '$API_URL')).toBeTrue();
|
||||
expect(_has(env, 'irbUrl', '$IRB_URL')).toBeTrue();
|
||||
expect(_has(env, 'title', '$TITLE')).toBeTrue();
|
||||
expect(_has(env, 'googleAnalyticsKey', '$GOOGLE_ANALYTICS_KEY')).toBeTrue();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue