open-consul/ui/packages/consul-ui/tests/integration/serializers/topology-test.js
Kenia 285962b25b
ui: Topology Intentions Popovers (#9137)
* Refactor grid styling for Topology page

* Crate TopologyMetrics Button component and move styling

* Create intention ID

* fixup button styling

* Return a link to the create intention page

* Rename Button to Popover component

* Fixup serializer test

* ui: Inline Topology Intention Actions  (#9153)

* Add arrow and dot to/from metrics back in

* Add addional space to have metrics wrap and show in smaller screens

* Move logic for finding positioning

* Use color variables

Co-authored-by: John Cowen <johncowen@users.noreply.github.com>
2020-11-12 10:40:15 -05:00

40 lines
1.2 KiB
JavaScript

import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { get } from 'consul-ui/tests/helpers/api';
import { HEADERS_SYMBOL as META } from 'consul-ui/utils/http/consul';
module('Integration | Serializer | topology', function(hooks) {
setupTest(hooks);
test('respondForQueryRecord returns the correct data for item endpoint', function(assert) {
const serializer = this.owner.lookup('serializer:topology');
const dc = 'dc-1';
const id = 'slug';
const kind = '';
const request = {
url: `/v1/internal/ui/service-topology/${id}?dc=${dc}&kind=${kind}`,
};
return get(request.url).then(function(payload) {
const expected = {
Datacenter: dc,
[META]: {},
uid: `["default","${dc}","${id}"]`,
};
const actual = serializer.respondForQueryRecord(
function(cb) {
const headers = {};
const body = payload;
return cb(headers, body);
},
{
dc: dc,
id: id,
kind: kind,
}
);
assert.equal(actual.Datacenter, expected.Datacenter);
assert.equal(actual.uid, expected.uid);
});
});
});