fix: 🐛 tests fix

This commit is contained in:
dharini committed 2021-08-30 21:49:48 -07:00
1 parent 40c2acd6ab
commit ce286964d1
1 file changed
+10 -18
+10 -18
View File
@@ -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}"]`));
});