open-vault/ui/tests/unit/adapters/capabilities-test.js
2018-04-03 09:16:57 -05:00

22 lines
665 B
JavaScript

import { moduleFor, test } from 'ember-qunit';
import Ember from 'ember';
moduleFor('adapter:capabilities', 'Unit | Adapter | capabilities', {
needs: ['service:auth', 'service:flash-messages'],
});
test('calls the correct url', function(assert) {
let url, method, options;
let adapter = this.subject({
ajax: (...args) => {
[url, method, options] = args;
return Ember.RSVP.resolve();
},
});
adapter.findRecord(null, 'capabilities', 'foo');
assert.equal('/v1/sys/capabilities-self', url, 'calls the correct URL');
assert.deepEqual({ path: 'foo' }, options.data, 'data params OK');
assert.equal('POST', method, 'method OK');
});