chore: 🤖 merge from main
This commit is contained in:
41 files changed
+3534
-1001
No files matched your search
@@ -10,6 +10,7 @@ import {
|
||||
// //currentSession,
|
||||
// //invalidateSession,
|
||||
} from 'ember-simple-auth/test-support';
|
||||
import { enableFeature } from 'ember-feature-flags/test-support';
|
||||
|
||||
module('Acceptance | auth methods', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
@@ -270,4 +271,118 @@ module('Acceptance | auth methods', function (hooks) {
|
||||
'Displays field-level errors.'
|
||||
);
|
||||
});
|
||||
|
||||
test('user can make primary an auth method', async function (assert) {
|
||||
assert.expect(2);
|
||||
assert.notOk(
|
||||
instances.scopes.org.primaryAuthMethodId,
|
||||
'Primary auth method is not yet set.'
|
||||
);
|
||||
enableFeature('primary-auth-method');
|
||||
await visit(urls.authMethod);
|
||||
await click(
|
||||
'.rose-layout-page-actions .rose-dropdown-content [type="button"]:first-child'
|
||||
);
|
||||
const scope = this.server.schema.scopes.find(instances.scopes.org.id);
|
||||
assert.equal(
|
||||
scope.primaryAuthMethodId,
|
||||
instances.authMethod.id,
|
||||
'Primary auth method is set.'
|
||||
);
|
||||
});
|
||||
|
||||
test('user is notified of error on make primary an auth method', async function (assert) {
|
||||
assert.expect(2);
|
||||
this.server.patch('/scopes/:id', () => {
|
||||
return new Response(
|
||||
400,
|
||||
{},
|
||||
{
|
||||
status: 400,
|
||||
code: 'fail',
|
||||
message: 'Sorry!',
|
||||
}
|
||||
);
|
||||
});
|
||||
assert.notOk(
|
||||
instances.scopes.org.primaryAuthMethodId,
|
||||
'Primary auth method is not yet set.'
|
||||
);
|
||||
enableFeature('primary-auth-method');
|
||||
await visit(urls.authMethod);
|
||||
await click(
|
||||
'.rose-layout-page-actions .rose-dropdown-content [type="button"]:first-child'
|
||||
);
|
||||
assert.ok(find('.rose-notification'));
|
||||
});
|
||||
|
||||
test('user can remove as primary an auth method', async function (assert) {
|
||||
assert.expect(2);
|
||||
instances.scopes.org.update({
|
||||
primaryAuthMethodId: instances.authMethod.id,
|
||||
});
|
||||
assert.ok(
|
||||
instances.scopes.org.primaryAuthMethodId,
|
||||
'Primary auth method is set.'
|
||||
);
|
||||
enableFeature('primary-auth-method');
|
||||
await visit(urls.authMethod);
|
||||
await click(
|
||||
'.rose-layout-page-actions .rose-dropdown-content [type="button"]:first-child'
|
||||
);
|
||||
const scope = this.server.schema.scopes.find(instances.scopes.org.id);
|
||||
assert.notOk(scope.primaryAuthMethodId, 'Primary auth method is unset.');
|
||||
});
|
||||
|
||||
test('user is notified of error on remove as primary an auth method', async function (assert) {
|
||||
assert.expect(2);
|
||||
this.server.patch('/scopes/:id', () => {
|
||||
return new Response(
|
||||
400,
|
||||
{},
|
||||
{
|
||||
status: 400,
|
||||
code: 'fail',
|
||||
message: 'Sorry!',
|
||||
}
|
||||
);
|
||||
});
|
||||
instances.scopes.org.update({
|
||||
primaryAuthMethodId: instances.authMethod.id,
|
||||
});
|
||||
assert.ok(
|
||||
instances.scopes.org.primaryAuthMethodId,
|
||||
'Primary auth method is set.'
|
||||
);
|
||||
enableFeature('primary-auth-method');
|
||||
await visit(urls.authMethod);
|
||||
await click(
|
||||
'.rose-layout-page-actions .rose-dropdown-content [type="button"]:first-child'
|
||||
);
|
||||
assert.ok(find('.rose-notification'));
|
||||
});
|
||||
|
||||
test('user can make and remove primary auth methods from index', async function (assert) {
|
||||
assert.expect(3);
|
||||
assert.notOk(
|
||||
instances.scopes.org.primaryAuthMethodId,
|
||||
'Primary auth method is not yet set.'
|
||||
);
|
||||
enableFeature('primary-auth-method');
|
||||
await visit(urls.authMethods);
|
||||
await click(
|
||||
'.rose-table-body .rose-table-row:first-child .rose-dropdown-content [type="button"]:first-child'
|
||||
);
|
||||
let scope = this.server.schema.scopes.find(instances.scopes.org.id);
|
||||
assert.equal(
|
||||
scope.primaryAuthMethodId,
|
||||
instances.authMethod.id,
|
||||
'Primary auth method is set.'
|
||||
);
|
||||
await click(
|
||||
'.rose-table-body .rose-table-row:first-child .rose-dropdown-content [type="button"]:first-child'
|
||||
);
|
||||
scope = this.server.schema.scopes.find(instances.scopes.org.id);
|
||||
assert.notOk(scope.primaryAuthMethodId, 'Primary auth method is unset.');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,14 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Controller | scopes/scope/auth-methods/index', function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
// TODO: Replace this with your real tests.
|
||||
test('it exists', function (assert) {
|
||||
let controller = this.owner.lookup(
|
||||
'controller:scopes/scope/auth-methods/index'
|
||||
);
|
||||
assert.ok(controller);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user