From 96b9a208449e624449a3317ac8db40f5b23f77eb Mon Sep 17 00:00:00 2001 From: Carlos Alcaide Corvo Date: Mon, 2 Dec 2024 11:51:12 -0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=F0=9F=92=A1=20Add=20await=20to=20i?= =?UTF-8?q?nvalidSession=20within=20desktop=20(#2598)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/desktop/tests/acceptance/application-test.js | 4 ++-- ui/desktop/tests/acceptance/authentication-test.js | 4 ++-- ui/desktop/tests/acceptance/cluster-url-test.js | 4 ++-- ui/desktop/tests/acceptance/projects-test.js | 2 +- ui/desktop/tests/acceptance/projects/sessions/index-test.js | 2 +- ui/desktop/tests/acceptance/projects/targets/index-test.js | 2 +- ui/desktop/tests/acceptance/scopes-test.js | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ui/desktop/tests/acceptance/application-test.js b/ui/desktop/tests/acceptance/application-test.js index 1bc56832d..f841c4c34 100644 --- a/ui/desktop/tests/acceptance/application-test.js +++ b/ui/desktop/tests/acceptance/application-test.js @@ -24,8 +24,8 @@ module('Acceptance | index', function (hooks) { clusterUrl: null, }; - hooks.beforeEach(function () { - invalidateSession(); + hooks.beforeEach(async function () { + await invalidateSession(); urls.clusterUrl = '/cluster-url'; diff --git a/ui/desktop/tests/acceptance/authentication-test.js b/ui/desktop/tests/acceptance/authentication-test.js index e84dc69ca..1a848c9e3 100644 --- a/ui/desktop/tests/acceptance/authentication-test.js +++ b/ui/desktop/tests/acceptance/authentication-test.js @@ -64,12 +64,12 @@ module('Acceptance | authentication', function (hooks) { clusterUrl.rendererClusterUrl = windowOrigin; }; - hooks.beforeEach(function () { + hooks.beforeEach(async function () { instances.user = this.server.create('user', { scope: instances.scopes.global, }); - invalidateSession(); + await invalidateSession(); // create scopes instances.scopes.global = this.server.create('scope', { id: 'global' }); diff --git a/ui/desktop/tests/acceptance/cluster-url-test.js b/ui/desktop/tests/acceptance/cluster-url-test.js index b5d6be601..14d7db380 100644 --- a/ui/desktop/tests/acceptance/cluster-url-test.js +++ b/ui/desktop/tests/acceptance/cluster-url-test.js @@ -63,8 +63,8 @@ module('Acceptance | clusterUrl', function (hooks) { mockIPC = test.owner.lookup('service:browser/window').mockIPC; }; - hooks.beforeEach(function () { - invalidateSession(); + hooks.beforeEach(async function () { + await invalidateSession(); // create scopes instances.scopes.global = this.server.create('scope', { id: 'global' }); diff --git a/ui/desktop/tests/acceptance/projects-test.js b/ui/desktop/tests/acceptance/projects-test.js index 65d8515f1..efa7a66ad 100644 --- a/ui/desktop/tests/acceptance/projects-test.js +++ b/ui/desktop/tests/acceptance/projects-test.js @@ -102,7 +102,7 @@ module('Acceptance | projects', function (hooks) { }); test('visiting index while unauthenticated redirects to global authenticate method', async function (assert) { - invalidateSession(); + await invalidateSession(); assert.expect(2); await visit(urls.projects); await a11yAudit(); diff --git a/ui/desktop/tests/acceptance/projects/sessions/index-test.js b/ui/desktop/tests/acceptance/projects/sessions/index-test.js index 719a31f1d..26fcd73ef 100644 --- a/ui/desktop/tests/acceptance/projects/sessions/index-test.js +++ b/ui/desktop/tests/acceptance/projects/sessions/index-test.js @@ -163,7 +163,7 @@ module('Acceptance | projects | sessions | index', function (hooks) { }); test('visiting index while unauthenticated redirects to global authenticate method', async function (assert) { - invalidateSession(); + await invalidateSession(); this.stubCacheDaemonSearch(); await visit(urls.sessions); diff --git a/ui/desktop/tests/acceptance/projects/targets/index-test.js b/ui/desktop/tests/acceptance/projects/targets/index-test.js index 5ba046f5e..f8a0f0633 100644 --- a/ui/desktop/tests/acceptance/projects/targets/index-test.js +++ b/ui/desktop/tests/acceptance/projects/targets/index-test.js @@ -165,7 +165,7 @@ module('Acceptance | projects | targets | index', function (hooks) { }); test('visiting index while unauthenticated redirects to global authenticate method', async function (assert) { - invalidateSession(); + await invalidateSession(); this.stubCacheDaemonSearch(); await visit(urls.targets); await a11yAudit(); diff --git a/ui/desktop/tests/acceptance/scopes-test.js b/ui/desktop/tests/acceptance/scopes-test.js index 167e6c91b..f3a5b6574 100644 --- a/ui/desktop/tests/acceptance/scopes-test.js +++ b/ui/desktop/tests/acceptance/scopes-test.js @@ -239,7 +239,7 @@ module('Acceptance | scopes', function (hooks) { }); test('visiting index while unauthenticated redirects to global authenticate method', async function (assert) { - invalidateSession(); + await invalidateSession(); assert.expect(2); this.stubCacheDaemonSearch(); @@ -363,7 +363,7 @@ module('Acceptance | scopes', function (hooks) { }); test('pagination is not supported - navigate to cluster url page', async function (assert) { - invalidateSession(); + await invalidateSession(); this.stubCacheDaemonSearch(); this.ipcStub.withArgs('checkOS').returns({ isWindows: true,