open-consul/ui/packages/consul-ui/tests/helpers/get-nspace-runner.js
John Cowen 7083c39b96
ui: Support Route optional parameters/segments (#10212)
Moves our URLs with 'optional namespace segment' into a separately abstracted 'optional URL segment' feature
2021-05-26 17:43:46 +01:00

21 lines
715 B
JavaScript

export default function(type) {
return function(cb, withNspaces, withoutNspaces, container, assert) {
let CONSUL_NSPACES_ENABLED = true;
const env = container.owner.lookup('service:env');
env.var = function() {
return CONSUL_NSPACES_ENABLED;
};
const adapter = container.owner.lookup(`adapter:${type}`);
const serializer = container.owner.lookup(`serializer:${type}`);
const client = container.owner.lookup('service:client/http');
let actual;
actual = cb(adapter, serializer, client);
assert.deepEqual(actual[0], withNspaces);
CONSUL_NSPACES_ENABLED = false;
actual = cb(adapter, serializer, client);
assert.deepEqual(actual[0], withoutNspaces);
};
}