tests: Update unit tests in desktop

This commit is contained in:
Susmitha Girumala committed 2021-03-19 12:09:06 -04:00
1 parent 6ce09162d7
commit 6bd994c86b
1 file changed
+19 -4
+19 -4
View File
@@ -1,12 +1,27 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import sinon from 'sinon';
module('Unit | Service | origin', function (hooks) {
setupTest(hooks);
// TODO: Replace this with your real tests.
test('it exists', function (assert) {
let service = this.owner.lookup('service:origin');
assert.ok(service);
let service, ipcService;
hooks.beforeEach(function () {
service = this.owner.lookup('service:origin');
ipcService = this.owner.lookup('service:ipc');
});
test('resets origin on error', async function (assert) {
assert.expect(4);
const ipcServiceStubbed = sinon.stub(ipcService, 'invoke');
await service.setOrigin(window.location.origin);
assert.equal(service.rendererOrigin, window.location.origin);
assert.equal(service.adapter.host, window.location.origin);
ipcServiceStubbed.withArgs('setOrigin').rejects();
service.setOrigin('invalid-origin').catch(() => {
assert.notOk(service.rendererOrigin);
assert.equal(service.adapter.host, window.location.origin);
});
});
});