test: 💍 fix tests
This commit is contained in:
1 parent
3a3fdf2396
commit
e291956c1b
2 files changed
+41
-25
No files matched your search
@@ -19,6 +19,7 @@ module('Acceptance | groups | list', function (hooks) {
|
||||
global: null,
|
||||
org: null,
|
||||
},
|
||||
orgScope: null,
|
||||
};
|
||||
|
||||
const urls = {
|
||||
@@ -26,20 +27,11 @@ module('Acceptance | groups | list', function (hooks) {
|
||||
org: null,
|
||||
},
|
||||
groups: 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,12 +40,11 @@ module('Acceptance | groups | list', function (hooks) {
|
||||
'withChildren'
|
||||
);
|
||||
instances.group = this.server.create('group', {
|
||||
scope: instances.org,
|
||||
scope: instances.orgScope,
|
||||
});
|
||||
orgURL = `/scopes/${urls.orgScope.id}`;
|
||||
//urls.orgScope = `/scopes/${instances.org.id}/scopes`;
|
||||
orgURL = `/scopes/${instances.orgScope.id}`;
|
||||
|
||||
urls.groups = `/scopes/${urls.orgScope.id}/groups`;
|
||||
urls.groups = `/scopes/${instances.orgScope.id}/groups`;
|
||||
authenticateSession({});
|
||||
});
|
||||
|
||||
@@ -61,24 +52,24 @@ module('Acceptance | groups | list', function (hooks) {
|
||||
assert.expect(2);
|
||||
await visit(orgURL);
|
||||
assert.ok(
|
||||
urls.orgScope.authorized_collection_actions.groups.includes('list')
|
||||
instances.orgScope.authorized_collection_actions.groups.includes('list')
|
||||
);
|
||||
assert.ok(find(`[href="${urls.groups}"]`));
|
||||
});
|
||||
|
||||
test('User cannot navigate to index without either list or create actions', async function (assert) {
|
||||
assert.expect(2);
|
||||
urls.orgScope.authorized_collection_actions.groups = [];
|
||||
instances.orgScope.authorized_collection_actions.groups = [];
|
||||
await visit(orgURL);
|
||||
assert.notOk(
|
||||
urls.orgScope.authorized_collection_actions.groups.includes('list')
|
||||
instances.orgScope.authorized_collection_actions.groups.includes('list')
|
||||
);
|
||||
assert.notOk(find(`[href="${urls.groups}"]`));
|
||||
});
|
||||
|
||||
test('User can navigate to index with only create action', async function (assert) {
|
||||
assert.expect(1);
|
||||
urls.orgScope.authorized_collection_actions.groups = ['create'];
|
||||
instances.orgScope.authorized_collection_actions.groups = ['create'];
|
||||
await visit(orgURL);
|
||||
assert.ok(find(`[href="${urls.groups}"]`));
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user