chore: 🤖 deprecate window object service (#1652)

* chore: 🤖 deprecate window object service

Deprecate `browser-object` service in favor of `ember-browser-services`

✅ Closes: ICU-7152

* refactor: 💡 cluster-url test fail

commit with cluster-url test failing

✅ Closes: ICU-7152

* refactor: 💡 refactor test to reflect changes

Refactor test to reflect `browser/window` service in `cluster-url` route

✅ Closes: ICU-7152

* refactor: 💡 refactor cluster url test

change logic of mockIPC to a function call

✅ Closes: ICU-7152
This commit is contained in:
Devon Anderson authored and GitHub committed 2023-03-07 16:55:24 -05:00
1 parent 0a76111944
commit 3ba53dfc2e
8 files changed
+27 -104

No files matched your search

@@ -58,6 +58,10 @@ module('Acceptance | clusterUrl', function (hooks) {
projects: null,
targets: null,
};
const setupMockIpc = (test) => {
test.owner.register('service:browser/window', WindowMockIPC);
mockIPC = test.owner.lookup('service:browser/window').mockIPC;
};
hooks.beforeEach(function () {
invalidateSession();
@@ -96,10 +100,6 @@ module('Acceptance | clusterUrl', function (hooks) {
urls.authenticate.methods.global = `${urls.authenticate.global}/${instances.authMethods.global.id}`;
urls.projects = `${urls.scopes.global}/projects`;
urls.targets = `${urls.projects}/targets`;
// Mock the postMessage interface used by IPC.
this.owner.register('service:browser/window', WindowMockIPC);
mockIPC = this.owner.lookup('service:browser/window').mockIPC;
});
hooks.afterEach(function () {
@@ -115,6 +115,7 @@ module('Acceptance | clusterUrl', function (hooks) {
test('visiting index without a clusterUrl specified redirects to clusterUrl route', async function (assert) {
assert.expect(2);
setupMockIpc(this);
await visit(urls.index);
await a11yAudit();
assert.notOk(mockIPC.clusterUrl);
@@ -123,6 +124,7 @@ module('Acceptance | clusterUrl', function (hooks) {
test('can set clusterUrl', async function (assert) {
assert.expect(3);
setupMockIpc(this);
assert.notOk(mockIPC.clusterUrl);
await visit(urls.clusterUrl);
await fillIn('[name="host"]', currentOrigin);
@@ -133,6 +135,7 @@ module('Acceptance | clusterUrl', function (hooks) {
test('can reset clusterUrl before authentication', async function (assert) {
assert.expect(4);
setupMockIpc(this);
assert.notOk(mockIPC.clusterUrl);
await visit(urls.clusterUrl);
await fillIn('[name="host"]', currentOrigin);
@@ -145,6 +148,7 @@ module('Acceptance | clusterUrl', function (hooks) {
test('captures error on clusterUrl update', async function (assert) {
assert.expect(2);
setupMockIpc(this);
assert.notOk(mockIPC.clusterUrl);
sinon
.stub(this.owner.lookup('service:clusterUrl'), 'setClusterUrl')