From ce286964d11a85d3d1305de598a6a65e28a2e04c Mon Sep 17 00:00:00 2001 From: dharini Date: Mon, 30 Aug 2021 21:49:48 -0700 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20tests=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/admin/tests/acceptance/users/list-test.js | 28 +++++++------------- 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/ui/admin/tests/acceptance/users/list-test.js b/ui/admin/tests/acceptance/users/list-test.js index d752d8687..72a6e35eb 100644 --- a/ui/admin/tests/acceptance/users/list-test.js +++ b/ui/admin/tests/acceptance/users/list-test.js @@ -19,6 +19,7 @@ module('Acceptance | users | list', function (hooks) { global: null, org: null, }, + orgScope: null, }; const urls = { @@ -26,20 +27,11 @@ module('Acceptance | users | list', function (hooks) { org: null, }, users: null, - orgScope: null, }; hooks.beforeEach(function () { instances.scopes.global = this.server.create('scope', { id: 'global' }); - urls.orgScope = this.server.create( - 'scope', - { - type: 'org', - scope: { id: 'global', type: 'global' }, - }, - 'withChildren' - ); - instances.org = this.server.create( + instances.orgScope = this.server.create( 'scope', { type: 'org', @@ -48,10 +40,10 @@ module('Acceptance | users | list', function (hooks) { 'withChildren' ); instances.user = this.server.create('user', { - scope: instances.org, + scope: instances.orgScope, }); - orgURL = `/scopes/${urls.orgScope.id}`; - urls.users = `/scopes/${urls.orgScope.id}/users`; + orgURL = `/scopes/${instances.orgScope.id}`; + urls.users = `/scopes/${instances.orgScope.id}/users`; authenticateSession({}); }); @@ -59,24 +51,24 @@ module('Acceptance | users | list', function (hooks) { assert.expect(2); await visit(orgURL); assert.ok( - urls.orgScope.authorized_collection_actions.users.includes('list') + instances.orgScope.authorized_collection_actions.users.includes('list') ); assert.ok(find(`[href="${urls.users}"]`)); }); test('User cannot navigate to index without either list or create actions', async function (assert) { assert.expect(2); - urls.orgScope.authorized_collection_actions.users = []; + instances.orgScope.authorized_collection_actions.users = []; await visit(orgURL); assert.notOk( - urls.orgScope.authorized_collection_actions.users.includes('list') + instances.orgScope.authorized_collection_actions.users.includes('list') ); - assert.notOk(find(`[href="${urls.usersorgURL}"]`)); + assert.notOk(find(`[href="${urls.users}"]`)); }); test('User can navigate to index with only create action', async function (assert) { assert.expect(1); - urls.orgScope.authorized_collection_actions.users = ['create']; + instances.orgScope.authorized_collection_actions.users = ['create']; await visit(orgURL); assert.ok(find(`[href="${urls.users}"]`)); });