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

23 lines
716 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 | capabilities', function(hooks) {
setupTest(hooks);
2018-04-03 14:16:57 +00:00
test('calls the correct url', function(assert) {
let url, method, options;
let adapter = this.owner.factoryFor('adapter:capabilities').create({
ajax: (...args) => {
[url, method, options] = args;
return resolve();
},
});
2018-04-03 14:16:57 +00:00
adapter.findRecord(null, 'capabilities', 'foo');
assert.equal('/v1/sys/capabilities-self', url, 'calls the correct URL');
assert.deepEqual({ paths: ['foo'] }, options.data, 'data params OK');
assert.equal('POST', method, 'method OK');
});
2018-04-03 14:16:57 +00:00
});