c98130cc08
* 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
46 lines
1.5 KiB
JavaScript
46 lines
1.5 KiB
JavaScript
import { module, test } from 'qunit';
|
|
import { setupTest } from 'ember-qunit';
|
|
|
|
import { get } from 'consul-ui/tests/helpers/api';
|
|
// Nspace don't need any datacenter or nspace, and don't
|
|
module('Integration | Serializer | nspace', function(hooks) {
|
|
setupTest(hooks);
|
|
test('respondForQuery returns the correct data for list endpoint', function(assert) {
|
|
const serializer = this.owner.lookup('serializer:nspace');
|
|
const request = {
|
|
url: `/v1/namespaces`,
|
|
};
|
|
return get(request.url).then(function(payload) {
|
|
const expected = payload.map(item => Object.assign({}, item, {}));
|
|
const actual = serializer.respondForQuery(function(cb) {
|
|
const headers = {};
|
|
const body = payload;
|
|
return cb(headers, body);
|
|
}, {});
|
|
assert.deepEqual(actual, expected);
|
|
});
|
|
});
|
|
test('respondForQueryRecord returns the correct data for item endpoint', function(assert) {
|
|
const serializer = this.owner.lookup('serializer:nspace');
|
|
const id = 'slug';
|
|
const request = {
|
|
url: `/v1/namespace/${id}`,
|
|
};
|
|
return get(request.url).then(function(payload) {
|
|
// Namespace items don't currently get META attached
|
|
const expected = payload;
|
|
const actual = serializer.respondForQueryRecord(
|
|
function(cb) {
|
|
const headers = {};
|
|
const body = payload;
|
|
return cb(headers, body);
|
|
},
|
|
{
|
|
id: id,
|
|
}
|
|
);
|
|
assert.deepEqual(actual, expected);
|
|
});
|
|
});
|
|
});
|