2023-03-15 16:00:52 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
*/
|
|
|
|
|
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 | capabilities', 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('calls the correct url', 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:capabilities').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.findRecord(null, 'capabilities', 'foo');
|
2022-10-18 15:46:02 +00:00
|
|
|
assert.strictEqual(url, '/v1/sys/capabilities-self', 'calls the correct URL');
|
2018-09-25 16:28:26 +00:00
|
|
|
assert.deepEqual({ paths: ['foo'] }, options.data, 'data params OK');
|
2022-10-18 15:46:02 +00:00
|
|
|
assert.strictEqual(method, 'POST', 'method OK');
|
2018-09-25 16:28:26 +00:00
|
|
|
});
|
2018-04-03 14:16:57 +00:00
|
|
|
});
|