tests: Update unit tests in desktop
This commit is contained in:
1 file changed
+19
-4
@@ -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);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user