open-vault/ui/tests/unit/adapters/secret-test.js

27 lines
927 B
JavaScript
Raw Normal View History

import { resolve } from 'rsvp';
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
2018-04-03 14:16:57 +00:00
module('Unit | Adapter | secret', function(hooks) {
setupTest(hooks);
2018-04-03 14:16:57 +00:00
test('secret api urls', function(assert) {
let url, method, options;
let adapter = this.owner.factoryFor('adapter:secret').create({
ajax: (...args) => {
[url, method, options] = args;
return resolve({});
},
});
2018-04-03 14:16:57 +00:00
adapter.query({}, 'secret', { id: '', backend: 'secret' });
assert.equal(url, '/v1/secret/', 'query generic url OK');
assert.equal('GET', method, 'query generic method OK');
assert.deepEqual(options, { data: { list: true } }, 'query generic url OK');
2018-04-03 14:16:57 +00:00
adapter.queryRecord({}, 'secret', { id: 'foo', backend: 'secret' });
assert.equal(url, '/v1/secret/foo', 'queryRecord generic url OK');
assert.equal('GET', method, 'queryRecord generic method OK');
});
2018-04-03 14:16:57 +00:00
});