2018-04-03 14:16:57 +00:00
|
|
|
import { moduleFor, test } from 'ember-qunit';
|
|
|
|
import Ember from 'ember';
|
|
|
|
|
2018-04-20 02:26:25 +00:00
|
|
|
moduleFor('adapter:secret-v2', 'Unit | Adapter | secret-v2', {
|
2018-04-03 14:16:57 +00:00
|
|
|
needs: ['service:auth', 'service:flash-messages'],
|
|
|
|
});
|
|
|
|
|
|
|
|
test('secret api urls', function(assert) {
|
|
|
|
let url, method, options;
|
|
|
|
let adapter = this.subject({
|
|
|
|
ajax: (...args) => {
|
|
|
|
[url, method, options] = args;
|
|
|
|
return Ember.RSVP.resolve({});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
adapter.query({}, 'secret', { id: '', backend: 'secret' });
|
2018-04-20 02:26:25 +00:00
|
|
|
assert.equal(url, '/v1/secret/metadata/', 'query generic url OK');
|
2018-04-03 14:16:57 +00:00
|
|
|
assert.equal('GET', method, 'query generic method OK');
|
|
|
|
assert.deepEqual(options, { data: { list: true } }, 'query generic url OK');
|
|
|
|
|
|
|
|
adapter.queryRecord({}, 'secret', { id: 'foo', backend: 'secret' });
|
2018-04-20 02:26:25 +00:00
|
|
|
assert.equal(url, '/v1/secret/data/foo', 'queryRecord generic url OK');
|
2018-04-03 14:16:57 +00:00
|
|
|
assert.equal('GET', method, 'queryRecord generic method OK');
|
|
|
|
});
|