open-vault/ui/tests/unit/adapters/identity/entity-merge-test.js

30 lines
997 B
JavaScript
Raw Normal View History

2018-04-03 14:16:57 +00:00
import Pretender from 'pretender';
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
2018-04-03 14:16:57 +00:00
import { storeMVP } from './_test-cases';
module('Unit | Adapter | identity/entity-merge', function(hooks) {
setupTest(hooks);
hooks.beforeEach(function() {
2018-04-03 14:16:57 +00:00
this.server = new Pretender(function() {
this.post('/v1/**', response => {
return [response, { 'Content-Type': 'application/json' }, JSON.stringify({})];
});
});
});
hooks.afterEach(function() {
2018-04-03 14:16:57 +00:00
this.server.shutdown();
});
2018-04-03 14:16:57 +00:00
test(`entity-merge#createRecord`, function(assert) {
assert.expect(2);
let adapter = this.owner.lookup('adapter:identity/entity-merge');
adapter.createRecord(storeMVP, { modelName: 'identity/entity-merge' }, { attr: x => x });
let { url, method } = this.server.handledRequests[0];
assert.equal(url, `/v1/identity/entity/merge`, ` calls the correct url`);
assert.equal(method, 'POST', `uses the correct http verb: POST`);
});
2018-04-03 14:16:57 +00:00
});