open-consul/ui-v2/tests/integration/adapters/node/url-test.js

33 lines
1.0 KiB
JavaScript

import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Integration | Adapter | node | url', function(hooks) {
setupTest(hooks);
const dc = 'dc-1';
const id = 'node-name';
test('urlForQuery returns the correct url', function(assert) {
const adapter = this.owner.lookup('adapter:node');
const expected = `/v1/internal/ui/nodes?dc=${dc}`;
const actual = adapter.urlForQuery({
dc: dc,
});
assert.equal(actual, expected);
});
test('urlForQueryRecord returns the correct url', function(assert) {
const adapter = this.owner.lookup('adapter:node');
const expected = `/v1/internal/ui/node/${id}?dc=${dc}`;
const actual = adapter.urlForQueryRecord({
dc: dc,
id: id,
});
assert.equal(actual, expected);
});
test("urlForQueryRecord throws if you don't specify an id", function(assert) {
const adapter = this.owner.lookup('adapter:node');
assert.throws(function() {
adapter.urlForQueryRecord({
dc: dc,
});
});
});
});