2018-09-25 16:28:26 +00:00
|
|
|
import { resolve } from 'rsvp';
|
|
|
|
import { module, test } from 'qunit';
|
|
|
|
import { setupTest } from 'ember-qunit';
|
2018-04-03 14:16:57 +00:00
|
|
|
|
2021-12-17 03:44:29 +00:00
|
|
|
module('Unit | Adapter | secret', function (hooks) {
|
2018-09-25 16:28:26 +00:00
|
|
|
setupTest(hooks);
|
2018-04-03 14:16:57 +00:00
|
|
|
|
2021-12-17 03:44:29 +00:00
|
|
|
test('secret api urls', function (assert) {
|
2018-09-25 16:28:26 +00:00
|
|
|
let url, method, options;
|
2022-11-09 23:15:31 +00:00
|
|
|
const adapter = this.owner.factoryFor('adapter:secret').create({
|
2018-09-25 16:28:26 +00:00
|
|
|
ajax: (...args) => {
|
|
|
|
[url, method, options] = args;
|
|
|
|
return resolve({});
|
|
|
|
},
|
|
|
|
});
|
2018-04-03 14:16:57 +00:00
|
|
|
|
2018-09-25 16:28:26 +00:00
|
|
|
adapter.query({}, 'secret', { id: '', backend: 'secret' });
|
2022-10-18 15:46:02 +00:00
|
|
|
assert.strictEqual(url, '/v1/secret/', 'query generic url OK');
|
|
|
|
assert.strictEqual(method, 'GET', 'query generic method OK');
|
2018-09-25 16:28:26 +00:00
|
|
|
assert.deepEqual(options, { data: { list: true } }, 'query generic url OK');
|
2018-04-03 14:16:57 +00:00
|
|
|
|
2018-09-25 16:28:26 +00:00
|
|
|
adapter.queryRecord({}, 'secret', { id: 'foo', backend: 'secret' });
|
2022-10-18 15:46:02 +00:00
|
|
|
assert.strictEqual(url, '/v1/secret/foo', 'queryRecord generic url OK');
|
|
|
|
assert.strictEqual(method, 'GET', 'queryRecord generic method OK');
|
2018-09-25 16:28:26 +00:00
|
|
|
});
|
2018-04-03 14:16:57 +00:00
|
|
|
});
|