vault/ui/tests/unit/utils/api-path-test.js
Matthew Irish 5e002bec87
UI - add delete for the various kmip models (#7015)
* add menu-loader component to show menu loading button when the model relationship isPending

* list what keys we've got in api-path error

* fix spacing issue on error flash

* add an action on list-controller that bubbles to the list-route mixin to refresh the route

* empty store when creating scopes

* don't delete _requestQuery in the loop, do it after

* add scope deletion from the scope list

* add deleteRecord to kmip adapters

* add model-wrap component

* delete role from detail page and list

* add revoke credentials functionality

* fix comment

* treat all operations fields specially on kmip roles

* adjust kmip role edit form for new fields

* fix api-path test

* update document blocks for menu-loader and model-wrap components
2019-07-02 16:23:07 -05:00

24 lines
775 B
JavaScript

import apiPath from 'vault/utils/api-path';
import { module, test } from 'qunit';
module('Unit | Util | api path', function() {
test('it returns a function', function(assert) {
let ret = apiPath`foo`;
assert.ok(typeof ret === 'function');
});
test('it iterpolates strings from passed context object', function(assert) {
let ret = apiPath`foo/${'one'}/${'two'}`;
let result = ret({ one: 1, two: 2 });
assert.equal(result, 'foo/1/2', 'returns the expected string');
});
test('it throws when the key is not found in the context', function(assert) {
let ret = apiPath`foo/${'one'}/${'two'}`;
assert.throws(() => {
ret({ one: 1 });
}, /Error: Assertion Failed: Expected 2 keys in apiPath context, only recieved one/);
});
});