2018-04-03 14:16:57 +00:00
|
|
|
import { moduleFor, test } from 'ember-qunit';
|
|
|
|
import testCases from './_test-cases';
|
2018-04-20 02:26:25 +00:00
|
|
|
import apiStub from 'vault/tests/helpers/noop-all-api-requests';
|
2018-08-16 17:48:24 +00:00
|
|
|
import needs from 'vault/tests/unit/adapters/_adapter-needs';
|
2018-04-03 14:16:57 +00:00
|
|
|
|
|
|
|
moduleFor('adapter:identity/entity', 'Unit | Adapter | identity/entity', {
|
2018-08-16 17:48:24 +00:00
|
|
|
needs,
|
2018-04-03 14:16:57 +00:00
|
|
|
beforeEach() {
|
2018-04-20 02:26:25 +00:00
|
|
|
this.server = apiStub();
|
2018-04-03 14:16:57 +00:00
|
|
|
},
|
|
|
|
afterEach() {
|
|
|
|
this.server.shutdown();
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const cases = testCases('identit/entity');
|
|
|
|
|
|
|
|
cases.forEach(testCase => {
|
|
|
|
test(`entity#${testCase.adapterMethod}`, function(assert) {
|
|
|
|
assert.expect(2);
|
|
|
|
let adapter = this.subject();
|
|
|
|
adapter[testCase.adapterMethod](...testCase.args);
|
|
|
|
let { url, method } = this.server.handledRequests[0];
|
|
|
|
assert.equal(url, testCase.url, `${testCase.adapterMethod} calls the correct url: ${testCase.url}`);
|
|
|
|
assert.equal(
|
|
|
|
method,
|
|
|
|
testCase.method,
|
|
|
|
`${testCase.adapterMethod} uses the correct http verb: ${testCase.method}`
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|