chore: 🤖 manual merge from main
This commit is contained in:
98 files changed
+347
-344
No files matched your search
@@ -1,8 +1,7 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { visit, currentURL, find } from '@ember/test-helpers';
|
||||
import { visit, find } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'ember-qunit';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import a11yAudit from 'ember-a11y-testing/test-support/audit';
|
||||
import {
|
||||
authenticateSession,
|
||||
// These are left here intentionally for future reference.
|
||||
@@ -13,8 +12,7 @@ import {
|
||||
module('Acceptance | users | list', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
|
||||
let usersURL;
|
||||
let orgURL;
|
||||
|
||||
const instances = {
|
||||
scopes: {
|
||||
@@ -32,7 +30,7 @@ module('Acceptance | users | list', function (hooks) {
|
||||
|
||||
hooks.beforeEach(function () {
|
||||
instances.scopes.global = this.server.create('scope', { id: 'global' });
|
||||
instances.org = this.server.create(
|
||||
instances.orgScope = this.server.create(
|
||||
'scope',
|
||||
{
|
||||
type: 'org',
|
||||
@@ -41,17 +39,36 @@ module('Acceptance | users | list', function (hooks) {
|
||||
'withChildren'
|
||||
);
|
||||
instances.user = this.server.create('user', {
|
||||
scope: instances.org,
|
||||
scope: instances.orgScope,
|
||||
});
|
||||
urls.users = `/scopes/${instances.org.id}/users`;
|
||||
orgURL = `/scopes/${instances.orgScope.id}`;
|
||||
urls.users = `/scopes/${instances.orgScope.id}/users`;
|
||||
authenticateSession({});
|
||||
});
|
||||
|
||||
test('can navigate to users with proper authorization', async function (assert) {
|
||||
// TODO
|
||||
assert.expect(2);
|
||||
await visit(orgURL);
|
||||
assert.ok(
|
||||
instances.orgScope.authorized_collection_actions.users.includes('list')
|
||||
);
|
||||
assert.ok(find(`[href="${urls.users}"]`));
|
||||
});
|
||||
|
||||
test('cannot navigate to users with proper authorization', async function (assert) {
|
||||
// TODO
|
||||
test('User cannot navigate to index without either list or create actions', async function (assert) {
|
||||
assert.expect(2);
|
||||
instances.orgScope.authorized_collection_actions.users = [];
|
||||
await visit(orgURL);
|
||||
assert.notOk(
|
||||
instances.orgScope.authorized_collection_actions.users.includes('list')
|
||||
);
|
||||
assert.notOk(find(`[href="${urls.users}"]`));
|
||||
});
|
||||
|
||||
test('User can navigate to index with only create action', async function (assert) {
|
||||
assert.expect(1);
|
||||
instances.orgScope.authorized_collection_actions.users = ['create'];
|
||||
await visit(orgURL);
|
||||
assert.ok(find(`[href="${urls.users}"]`));
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user