open-consul/ui/packages/consul-ui/node-tests/config/environment.js
John Cowen c98130cc08
ui: Move to Workspaced Structure (#8994)
* ui: Add the most basic workspace root in /ui

* We already have a LICENSE file in the repository root

* Change directory path in build scripts ui-v2 -> ui

* Make yarn install flags configurable from elsewhere

* Minimal workspace root makefile

* Call the new docker specific target

* Update yarn in the docker build image

* Reconfigure the netlify target and move to the higher makefile

* Move ui-v2 -> ui/packages/consul-ui

* Change repo root to refleect new folder structure

* Temporarily don't hoist consul-api-double

* Fixup CI configuration

* Fixup lint errors

* Fixup Netlify target
2020-10-21 15:23:16 +01:00

70 lines
1.9 KiB
JavaScript

const test = require('tape');
const getEnvironment = require('../../config/environment.js');
test(
'config has the correct environment settings',
function(t) {
[
{
environment: 'production',
CONSUL_BINARY_TYPE: 'oss',
CONSUL_ACLS_ENABLED: '__RUNTIME_BOOL_ACLsEnabled__',
CONSUL_SSO_ENABLED: '__RUNTIME_BOOL_SSOEnabled__',
CONSUL_NSPACES_ENABLED: '__RUNTIME_BOOL_NamespacesEnabled__',
},
{
environment: 'test',
CONSUL_BINARY_TYPE: 'oss',
CONSUL_ACLS_ENABLED: true,
CONSUL_NSPACES_ENABLED: false,
CONSUL_SSO_ENABLED: false,
},
{
$: {
CONSUL_NSPACES_ENABLED: 1
},
environment: 'test',
CONSUL_BINARY_TYPE: 'oss',
CONSUL_ACLS_ENABLED: true,
CONSUL_NSPACES_ENABLED: true,
CONSUL_SSO_ENABLED: false,
},
{
$: {
CONSUL_SSO_ENABLED: 1
},
environment: 'test',
CONSUL_BINARY_TYPE: 'oss',
CONSUL_ACLS_ENABLED: true,
CONSUL_NSPACES_ENABLED: false,
CONSUL_SSO_ENABLED: true,
},
{
environment: 'staging',
CONSUL_BINARY_TYPE: 'oss',
CONSUL_ACLS_ENABLED: true,
CONSUL_NSPACES_ENABLED: true,
CONSUL_SSO_ENABLED: true,
}
].forEach(
function(item) {
const env = getEnvironment(item.environment, typeof item.$ !== 'undefined' ? item.$ : undefined);
Object.keys(item).forEach(
function(key) {
if(key === '$') {
return;
}
t.equal(
env[key],
item[key],
`Expect ${key} to equal ${item[key]} in the ${item.environment} environment ${typeof item.$ !== 'undefined' ? `(with ${JSON.stringify(item.$)})` : ''}`
);
}
);
}
);
t.end();
}
);