1d65f9e41a
* ui: Adds model layer required for SSO 1. oidc-provider ember-data triplet plus repo, plus addition of torii addon 2. Make blocking queries support a Cache-Control: no-cache header 3. Tweaks to the token model layer in preparation for SSO work * Fix up meta related Cache-Control tests * Add tests adapter tests for URL shapes * Reset Cache-Control to the original value, return something from logout
43 lines
1.2 KiB
JavaScript
43 lines
1.2 KiB
JavaScript
import { moduleFor, test } from 'ember-qunit';
|
|
import repo from 'consul-ui/tests/helpers/repo';
|
|
|
|
moduleFor('service:repository/discovery-chain', 'Integration | Repository | discovery-chain', {
|
|
// Specify the other units that are required for this test.
|
|
integration: true,
|
|
});
|
|
const dc = 'dc-1';
|
|
const id = 'slug';
|
|
test('findBySlug returns the correct data for item endpoint', function(assert) {
|
|
return repo(
|
|
'Service',
|
|
'findBySlug',
|
|
this.subject(),
|
|
function retrieveStub(stub) {
|
|
return stub(`/v1/discovery-chain/${id}?dc=${dc}`, {
|
|
CONSUL_DISCOVERY_CHAIN_COUNT: 1,
|
|
});
|
|
},
|
|
function performTest(service) {
|
|
return service.findBySlug(id, dc);
|
|
},
|
|
function performAssertion(actual, expected) {
|
|
const result = expected(function(payload) {
|
|
return Object.assign(
|
|
{},
|
|
{
|
|
Datacenter: dc,
|
|
uid: `["default","${dc}","${id}"]`,
|
|
meta: {
|
|
cacheControl: undefined,
|
|
cursor: undefined,
|
|
},
|
|
},
|
|
payload
|
|
);
|
|
});
|
|
assert.equal(actual.Datacenter, result.Datacenter);
|
|
assert.equal(actual.uid, result.uid);
|
|
}
|
|
);
|
|
});
|