test: 💍 add missing controller unit tests in admin-ui (#2553)

* test: 💍 add missing controller unit tests in admin-ui

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-14740
This commit is contained in:
Lisbet Alvarez authored and GitHub committed 2024-11-12 09:27:07 -08:00
1 parent 7c1814118d
commit 57568f9a8c
77 files changed
+946 -81

No files matched your search

@@ -8,8 +8,6 @@ import Controller, { inject as controller } from '@ember/controller';
export default class ScopesScopeAuthMethodsNewController extends Controller {
@controller('scopes/scope/auth-methods/index') authMethods;
// =services
// =attributes
queryParams = ['type'];
@@ -12,6 +12,7 @@ import { notifySuccess, notifyError } from 'core/decorators/notify';
export default class ScopesScopeStorageBucketsIndexController extends Controller {
// =services
@service router;
// =actions
@@ -63,7 +64,7 @@ export default class ScopesScopeStorageBucketsIndexController extends Controller
}
/**
* Updates credentil type
* Updates credential type
* @param {object} storageBucket
* @param {string} credentialType
*/
@@ -74,7 +75,7 @@ export default class ScopesScopeStorageBucketsIndexController extends Controller
/**
* Changes the plugin type.
* @param {*} pluginType
* @param {string} pluginType
*/
@action
async changePluginType(pluginType) {
@@ -0,0 +1,76 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { visit } from '@ember/test-helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { authenticateSession } from 'ember-simple-auth/test-support';
import { TYPE_AUTH_METHOD_PASSWORD } from 'api/models/auth-method';
module('Unit | Controller | account/change-password', function (hooks) {
setupTest(hooks);
setupMirage(hooks);
let controller;
let store;
const instances = {
scopes: {
global: null,
},
authMethod: null,
account: null,
};
const urls = {
globalScope: null,
};
hooks.beforeEach(async function () {
authenticateSession({});
controller = this.owner.lookup('controller:account/change-password');
store = this.owner.lookup('service:store');
instances.scopes.global = this.server.create('scope', {
id: 'global',
type: 'global',
});
instances.authMethod = this.server.create('auth-method', {
scope: instances.scopes.global,
type: TYPE_AUTH_METHOD_PASSWORD,
});
instances.account = this.server.create('account', {
scope: instances.scopes.global,
authMethod: instances.authMethod,
});
urls.globalScope = `/scopes/global`;
});
test('it exists', function (assert) {
assert.ok(controller);
});
test('changePassword action makes the correct API call with correct values', async function (assert) {
assert.expect(2);
const password = 'current password';
const newPassword = 'new password';
this.server.post(
'/accounts/:idMethod',
(_, { params: { idMethod }, requestBody }) => {
const attrs = JSON.parse(requestBody);
assert.strictEqual(attrs.current_password, password);
assert.strictEqual(attrs.new_password, newPassword);
const id = idMethod.split(':')[0];
return { id };
},
);
await visit(urls.globalScope);
const account = await store.findRecord('account', instances.account.id);
await controller.changePassword(account, password, newPassword);
});
});
@@ -5,12 +5,57 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { authenticateSession } from 'ember-simple-auth/test-support';
module('Unit | Controller | application', function (hooks) {
setupTest(hooks);
let controller;
let featureEdition;
let featuresService;
let session;
hooks.beforeEach(async function () {
authenticateSession({});
controller = this.owner.lookup('controller:application');
featureEdition = this.owner.lookup('service:featureEdition');
featuresService = this.owner.lookup('service:features');
session = this.owner.lookup('service:session');
});
test('it exists', function (assert) {
let controller = this.owner.lookup('controller:application');
assert.ok(controller);
});
test('invalidateSession action de-authenticates a user', async function (assert) {
assert.true(session.isAuthenticated);
await controller.invalidateSession();
assert.false(session.isAuthenticated);
});
test('toggleTheme action sets theme to specified value', function (assert) {
assert.notOk(session.data.theme);
controller.toggleTheme('light');
assert.strictEqual(session.data.theme, 'light');
});
test('toggleEdition action sets edition to specified value', function (assert) {
assert.notOk(featureEdition.edition);
controller.toggleEdition('oss');
assert.strictEqual(featureEdition.edition, 'oss');
});
test('toggleFeature action toggles specified feature', function (assert) {
assert.false(featuresService.isEnabled('ssh-target'));
controller.toggleFeature('ssh-target');
assert.true(featuresService.isEnabled('ssh-target'));
});
});
@@ -4,7 +4,7 @@
*/
import { module, test } from 'qunit';
import { setupTest } from 'admin/tests/helpers';
import { setupTest } from 'ember-qunit';
module(
'Unit | Controller | scopes/scope/aliases/alias/index',
@@ -16,6 +16,7 @@ module(
'controller:scopes/scope/aliases/alias/index',
);
assert.ok(controller);
assert.ok(controller.aliases);
});
},
);
@@ -4,7 +4,7 @@
*/
import { module, test } from 'qunit';
import { setupTest } from 'admin/tests/helpers';
import { setupTest } from 'ember-qunit';
module('Unit | Controller | scopes/scope/aliases/new', function (hooks) {
setupTest(hooks);
@@ -12,5 +12,6 @@ module('Unit | Controller | scopes/scope/aliases/new', function (hooks) {
test('it exists', function (assert) {
let controller = this.owner.lookup('controller:scopes/scope/aliases/new');
assert.ok(controller);
assert.ok(controller.aliases);
});
});
@@ -16,6 +16,7 @@ module(
'controller:scopes/scope/auth-methods/auth-method/accounts/account/index',
);
assert.ok(controller);
assert.ok(controller.accounts);
});
},
);
@@ -5,17 +5,77 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { visit } from '@ember/test-helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { authenticateSession } from 'ember-simple-auth/test-support';
import { TYPE_AUTH_METHOD_PASSWORD } from 'api/models/auth-method';
module(
'Unit | Controller | scopes/scope/auth-methods/auth-method/accounts/account/set-password',
function (hooks) {
setupTest(hooks);
setupMirage(hooks);
test('it exists', function (assert) {
let controller = this.owner.lookup(
let controller;
let store;
const instances = {
scopes: {
global: null,
},
authMethod: null,
account: null,
};
const urls = {
globalScope: null,
accounts: null,
};
hooks.beforeEach(async function () {
authenticateSession({});
controller = this.owner.lookup(
'controller:scopes/scope/auth-methods/auth-method/accounts/account/set-password',
);
store = this.owner.lookup('service:store');
instances.scopes.global = this.server.create('scope', {
id: 'global',
type: 'global',
});
instances.authMethod = this.server.create('auth-method', {
scope: instances.scopes.global,
type: TYPE_AUTH_METHOD_PASSWORD,
});
instances.account = this.server.create('account', {
scope: instances.scopes.global,
authMethod: instances.authMethod,
});
urls.globalScope = `/scopes/global`;
});
test('it exists', function (assert) {
assert.ok(controller);
assert.ok(controller.accounts);
});
test('setPassword action makes the correct API call with correct values', async function (assert) {
assert.expect(1);
const password = 'current password';
this.server.post(
'/accounts/:idMethod',
(_, { params: { idMethod }, requestBody }) => {
const attrs = JSON.parse(requestBody);
assert.strictEqual(attrs.password, password);
const id = idMethod.split(':')[0];
return { id };
},
);
await visit(urls.globalScope);
const account = await store.findRecord('account', instances.account.id);
await controller.setPassword(account, password);
});
},
);
@@ -5,17 +5,94 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { visit } from '@ember/test-helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIntl } from 'ember-intl/test-support';
import { authenticateSession } from 'ember-simple-auth/test-support';
import { TYPE_AUTH_METHOD_PASSWORD } from 'api/models/auth-method';
module(
'Unit | Controller | scopes/scope/auth-methods/auth-method/accounts/index',
function (hooks) {
setupTest(hooks);
setupMirage(hooks);
setupIntl(hooks, 'en-us');
test('it exists', function (assert) {
let controller = this.owner.lookup(
let controller;
let store;
let getAccountCount;
const instances = {
scopes: {
global: null,
},
authMethod: null,
account: null,
};
const urls = {
accounts: null,
};
hooks.beforeEach(async function () {
authenticateSession({});
controller = this.owner.lookup(
'controller:scopes/scope/auth-methods/auth-method/accounts/index',
);
store = this.owner.lookup('service:store');
instances.scopes.global = this.server.create('scope', {
id: 'global',
type: 'global',
});
instances.authMethod = this.server.create('auth-method', {
scope: instances.scopes.global,
type: TYPE_AUTH_METHOD_PASSWORD,
});
instances.account = this.server.create('account', {
scope: instances.scopes.global,
authMethod: instances.authMethod,
});
getAccountCount = () => this.server.schema.accounts.all().models.length;
urls.accounts = `/scopes/global/auth-methods/${instances.authMethod.id}/accounts`;
});
test('it exists', function (assert) {
assert.ok(controller);
assert.ok(controller.authMethods);
});
test('cancel action rolls-back changes on the specified model', async function (assert) {
await visit(urls.accounts);
const account = await store.findRecord('account', instances.account.id);
account.name = 'test';
assert.strictEqual(account.name, 'test');
await controller.cancel(account);
assert.notEqual(account.name, 'test');
});
test('save action saves changes on the specified model', async function (assert) {
await visit(urls.accounts);
const account = await store.findRecord('account', instances.account.id);
account.name = 'test';
await controller.save(account);
assert.strictEqual(account.name, 'test');
});
test('delete action destroys specified model', async function (assert) {
const account = await store.findRecord('account', instances.account.id);
const accountCount = getAccountCount();
await controller.delete(account);
assert.strictEqual(getAccountCount(), accountCount - 1);
});
},
);
@@ -16,6 +16,7 @@ module(
'controller:scopes/scope/auth-methods/auth-method/accounts/new',
);
assert.ok(controller);
assert.ok(controller.accounts);
});
},
);
@@ -16,6 +16,7 @@ module(
'controller:scopes/scope/auth-methods/auth-method/index',
);
assert.ok(controller);
assert.ok(controller.authMethods);
});
},
);
@@ -5,17 +5,117 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIntl } from 'ember-intl/test-support';
import { visit } from '@ember/test-helpers';
import { authenticateSession } from 'ember-simple-auth/test-support';
import { TYPE_AUTH_METHOD_LDAP } from 'api/models/auth-method';
module(
'Unit | Controller | scopes/scope/auth-methods/auth-method/managed-groups/index',
function (hooks) {
setupTest(hooks);
setupMirage(hooks);
setupIntl(hooks, 'en-us');
test('it exists', function (assert) {
let controller = this.owner.lookup(
let controller;
let store;
let getManagedGroupCount;
const instances = {
scopes: {
global: null,
},
authMethod: null,
managedGroup: null,
};
const urls = {
managedGroups: null,
};
hooks.beforeEach(async function () {
authenticateSession({});
controller = this.owner.lookup(
'controller:scopes/scope/auth-methods/auth-method/managed-groups/index',
);
store = this.owner.lookup('service:store');
instances.scopes.global = this.server.create('scope', {
id: 'global',
type: 'global',
});
instances.authMethod = this.server.create('auth-method', {
scope: instances.scopes.global,
type: TYPE_AUTH_METHOD_LDAP,
});
instances.managedGroup = this.server.create('managed-group', {
scope: instances.scopes.global,
authMethod: instances.authMethod,
});
getManagedGroupCount = () =>
this.server.schema.managedGroups.all().models.length;
urls.managedGroups = `/scopes/global/auth-methods/${instances.authMethod.id}/managed-groups`;
});
test('it exists', function (assert) {
assert.ok(controller);
assert.ok(controller.authMethods);
});
test('cancel action rolls-back changes on the specified model', async function (assert) {
await visit(urls.managedGroups);
const managedGroup = await store.findRecord(
'managed-group',
instances.managedGroup.id,
);
managedGroup.name = 'test';
assert.strictEqual(managedGroup.name, 'test');
await controller.cancel(managedGroup);
assert.notEqual(managedGroup.name, 'test');
});
test('save action saves changes on the specified model', async function (assert) {
await visit(urls.managedGroups);
const managedGroup = await store.findRecord(
'managed-group',
instances.managedGroup.id,
);
managedGroup.name = 'test';
await controller.save(managedGroup);
assert.strictEqual(managedGroup.name, 'test');
});
test('delete action destroys specified model', async function (assert) {
const managedGroup = await store.findRecord(
'managed-group',
instances.managedGroup.id,
);
const managedGroupCount = getManagedGroupCount();
await controller.delete(managedGroup);
assert.strictEqual(getManagedGroupCount(), managedGroupCount - 1);
});
test('edit action updates to a dirty state', async function (assert) {
const managedGroup = await store.findRecord(
'managed-group',
instances.managedGroup.id,
);
assert.false(managedGroup.hasDirtyAttributes);
controller.edit(managedGroup);
assert.true(managedGroup.hasDirtyAttributes);
});
},
);
@@ -16,6 +16,8 @@ module(
'controller:scopes/scope/auth-methods/auth-method/managed-groups/managed-group/index',
);
assert.ok(controller);
assert.ok(controller.authMethods);
assert.ok(controller.managedGroups);
});
},
);
@@ -16,6 +16,7 @@ module(
'controller:scopes/scope/auth-methods/auth-method/managed-groups/managed-group/members',
);
assert.ok(controller);
assert.ok(controller.managedGroups);
});
},
);
@@ -16,6 +16,8 @@ module(
'controller:scopes/scope/auth-methods/auth-method/managed-groups/new',
);
assert.ok(controller);
assert.ok(controller.authMethods);
assert.ok(controller.managedGroups);
});
},
);
@@ -43,7 +43,7 @@ module('Unit | Controller | scopes/scope/auth-methods/index', function (hooks) {
instances.scope.global = this.server.create('scope', { id: 'global' });
instances.authMethod = this.server.create('auth-method', {
scopeId: 'global',
scope: instances.scope.global,
});
getAuthMethodCount = () =>
@@ -14,5 +14,6 @@ module('Unit | Controller | scopes/scope/auth-methods/new', function (hooks) {
'controller:scopes/scope/auth-methods/new',
);
assert.ok(controller);
assert.ok(controller.authMethods);
});
});
@@ -16,6 +16,7 @@ module(
'controller:scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/index',
);
assert.ok(controller);
assert.ok(controller.credentialLibraries);
});
},
);
@@ -5,17 +5,127 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { visit } from '@ember/test-helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIntl } from 'ember-intl/test-support';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import { authenticateSession } from 'ember-simple-auth/test-support';
module(
'Unit | Controller | scopes/scope/credential-stores/credential-store/credential-libraries/index',
function (hooks) {
setupTest(hooks);
setupMirage(hooks);
setupIndexedDb(hooks);
setupIntl(hooks, 'en-us');
test('it exists', function (assert) {
let controller = this.owner.lookup(
let store;
let controller;
let getCredentialLibraryCount;
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
credentialStore: null,
credentialLibrary: null,
};
const urls = {
credentialLibraries: null,
};
hooks.beforeEach(function () {
authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/credential-stores/credential-store/credential-libraries/index',
);
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
});
instances.scopes.project = this.server.create('scope', {
type: 'project',
scope: { id: instances.scopes.org.id, type: 'org' },
});
instances.credentialStore = this.server.create('credential-store', {
scope: instances.scopes.project,
});
instances.credentialLibrary = this.server.create('credential-library', {
credentialStore: instances.credentialStore,
extensions: [{ key: 'foo', value: 'bar' }],
});
urls.credentialLibraries = `/scopes/${instances.scopes.project.id}/credential-stores/${instances.credentialStore.id}/credential-libraries`;
getCredentialLibraryCount = () =>
this.server.schema.credentialLibraries.all().models.length;
});
test('it exists', function (assert) {
assert.ok(controller);
assert.ok(controller.credentialStores);
});
test('cancel action rolls-back changes on the specified model', async function (assert) {
await visit(urls.credentialLibraries);
const credentialLibrary = await store.findRecord(
'credential-library',
instances.credentialLibrary.id,
);
credentialLibrary.name = 'test';
assert.strictEqual(credentialLibrary.name, 'test');
await controller.cancel(credentialLibrary);
assert.notEqual(credentialLibrary.name, 'test');
});
test('save action saves changes on the specified model', async function (assert) {
await visit(urls.credentialLibraries);
const credentialLibrary = await store.findRecord(
'credential-library',
instances.credentialLibrary.id,
);
credentialLibrary.name = 'test';
await controller.save(credentialLibrary);
assert.strictEqual(credentialLibrary.name, 'test');
});
test('delete action destroys specified model', async function (assert) {
const credentialLibrary = await store.findRecord(
'credential-library',
instances.credentialLibrary.id,
);
const credentialLibraryCount = getCredentialLibraryCount();
await controller.delete(credentialLibrary);
assert.strictEqual(
getCredentialLibraryCount(),
credentialLibraryCount - 1,
);
});
test('edit action updates to a dirty state', async function (assert) {
const credentialLibrary = await store.findRecord(
'credential-library',
instances.credentialLibrary.id,
);
assert.false(credentialLibrary.hasDirtyAttributes);
controller.edit(credentialLibrary);
assert.true(credentialLibrary.hasDirtyAttributes);
});
},
);
@@ -11,12 +11,12 @@ module(
function (hooks) {
setupTest(hooks);
// TODO: Replace this with your real tests.
test('it exists', function (assert) {
let controller = this.owner.lookup(
'controller:scopes/scope/credential-stores/credential-store/credential-libraries/new',
);
assert.ok(controller);
assert.ok(controller.credentialLibraries);
});
},
);
@@ -16,6 +16,7 @@ module(
'controller:scopes/scope/credential-stores/credential-store/credentials/credential/index',
);
assert.ok(controller);
assert.ok(controller.credentials);
});
},
);
@@ -5,17 +5,111 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { visit } from '@ember/test-helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIntl } from 'ember-intl/test-support';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import { authenticateSession } from 'ember-simple-auth/test-support';
module(
'Unit | Controller | scopes/scope/credential-stores/credential-store/credentials/index',
function (hooks) {
setupTest(hooks);
setupMirage(hooks);
setupIndexedDb(hooks);
setupIntl(hooks, 'en-us');
test('it exists', function (assert) {
let controller = this.owner.lookup(
let store;
let controller;
let getCredentialCount;
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
credentialStore: null,
credential: null,
};
const urls = {
credentials: null,
};
hooks.beforeEach(function () {
authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/credential-stores/credential-store/credentials/index',
);
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
});
instances.scopes.project = this.server.create('scope', {
type: 'project',
scope: { id: instances.scopes.org.id, type: 'org' },
});
instances.credentialStore = this.server.create('credential-store', {
scope: instances.scopes.project,
});
instances.credential = this.server.create('credential', {
credentialStore: instances.credentialStore,
extensions: [{ key: 'foo', value: 'bar' }],
});
urls.credentials = `/scopes/${instances.scopes.project.id}/credential-stores/${instances.credentialStore.id}/credentials`;
getCredentialCount = () =>
this.server.schema.credentials.all().models.length;
});
test('it exists', function (assert) {
assert.ok(controller);
assert.ok(controller.credentialStores);
});
test('cancel action rolls-back changes on the specified model', async function (assert) {
await visit(urls.credentials);
const credential = await store.findRecord(
'credential',
instances.credential.id,
);
credential.name = 'test';
assert.strictEqual(credential.name, 'test');
await controller.cancel(credential);
assert.notEqual(credential.name, 'test');
});
test('save action saves changes on the specified model', async function (assert) {
await visit(urls.credentials);
const credential = await store.findRecord(
'credential',
instances.credential.id,
);
credential.name = 'test';
await controller.save(credential);
assert.strictEqual(credential.name, 'test');
});
test('delete action destroys specified model', async function (assert) {
const credential = await store.findRecord(
'credential',
instances.credential.id,
);
const credentialCount = getCredentialCount();
await controller.delete(credential);
assert.strictEqual(getCredentialCount(), credentialCount - 1);
});
},
);
@@ -16,6 +16,7 @@ module(
'controller:scopes/scope/credential-stores/credential-store/credentials/new',
);
assert.ok(controller);
assert.ok(controller.credentials);
});
},
);
@@ -16,6 +16,7 @@ module(
'controller:scopes/scope/credential-stores/credential-store/index',
);
assert.ok(controller);
assert.ok(controller.credentialStores);
});
},
);
@@ -6,7 +6,10 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { setupIntl } from 'ember-intl/test-support';
import { waitUntil } from '@ember/test-helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import { waitUntil, visit } from '@ember/test-helpers';
import { authenticateSession } from 'ember-simple-auth/test-support';
import {
TYPE_CREDENTIAL_STORE_STATIC,
TYPE_CREDENTIAL_STORE_VAULT,
@@ -16,20 +19,97 @@ module(
'Unit | Controller | scopes/scope/credential-stores/index',
function (hooks) {
setupTest(hooks);
setupMirage(hooks);
setupIndexedDb(hooks);
setupIntl(hooks, 'en-us');
let controller;
let store;
let getCredentialStoreCount;
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
credentialStore: null,
};
const urls = {
credentialStores: null,
};
hooks.beforeEach(function () {
authenticateSession({});
controller = this.owner.lookup(
'controller:scopes/scope/credential-stores/index',
);
store = this.owner.lookup('service:store');
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
});
instances.scopes.project = this.server.create('scope', {
type: 'project',
scope: { id: instances.scopes.org.id, type: 'org' },
});
instances.credentialStore = this.server.create('credential-store', {
scope: instances.scopes.project,
});
urls.credentialStores = `scopes/${instances.scopes.project.id}/credential-stores`;
getCredentialStoreCount = () =>
this.server.schema.credentialStores.all().models.length;
});
test('it exists', function (assert) {
assert.ok(controller);
});
test('cancel action rolls-back changes on the specified model', async function (assert) {
await visit(urls.credentialStores);
const credentialStore = await store.findRecord(
'credential-store',
instances.credentialStore.id,
);
credentialStore.name = 'test';
assert.strictEqual(credentialStore.name, 'test');
await controller.cancel(credentialStore);
assert.notEqual(credentialStore.name, 'test');
});
test('save action saves changes on the specified model', async function (assert) {
await visit(urls.credentialStores);
const credentialStore = await store.findRecord(
'credential-store',
instances.credentialStore.id,
);
credentialStore.name = 'test';
await controller.save(credentialStore);
assert.strictEqual(credentialStore.name, 'test');
});
test('delete action destroys specified model', async function (assert) {
const credentialStore = await store.findRecord(
'credential-store',
instances.credentialStore.id,
);
const credentialStoreCount = getCredentialStoreCount();
await controller.delete(credentialStore);
assert.strictEqual(getCredentialStoreCount(), credentialStoreCount - 1);
});
test('credStoreTypeOptions returns expected object', function (assert) {
assert.deepEqual(controller.credStoreTypeOptions, [
{ id: TYPE_CREDENTIAL_STORE_STATIC, name: 'Static' },
@@ -16,6 +16,7 @@ module(
'controller:scopes/scope/credential-stores/new',
);
assert.ok(controller);
assert.ok(controller.credentialStores);
});
},
);
@@ -4,7 +4,7 @@
*/
import { module, test } from 'qunit';
import { setupTest } from 'admin/tests/helpers';
import { setupTest } from 'ember-qunit';
module('Unit | Controller | scopes/scope/groups/group/index', function (hooks) {
setupTest(hooks);
@@ -14,5 +14,6 @@ module('Unit | Controller | scopes/scope/groups/group/index', function (hooks) {
'controller:scopes/scope/groups/group/index',
);
assert.ok(controller);
assert.ok(controller.groups);
});
});
@@ -4,7 +4,7 @@
*/
import { module, test } from 'qunit';
import { setupTest } from 'admin/tests/helpers';
import { setupTest } from 'ember-qunit';
module(
'Unit | Controller | scopes/scope/groups/group/members',
@@ -16,6 +16,7 @@ module(
'controller:scopes/scope/groups/group/members',
);
assert.ok(controller);
assert.ok(controller.groups);
});
},
);
@@ -5,18 +5,57 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { waitUntil } from '@ember/test-helpers';
import { waitUntil, visit } from '@ember/test-helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import { setupIntl } from 'ember-intl/test-support';
import { authenticateSession } from 'ember-simple-auth/test-support';
module('Unit | Controller | scopes/scope/groups/index', function (hooks) {
setupTest(hooks);
setupMirage(hooks);
setupIndexedDb(hooks);
setupIntl(hooks, 'en-us');
let store;
let controller;
let getGroupCount;
const instances = {
scopes: {
global: null,
},
group: null,
user: null,
};
const urls = {
groups: null,
};
hooks.beforeEach(function () {
authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup('controller:scopes/scope/groups/index');
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.group = this.server.create('group', {
scope: instances.scopes.global,
});
instances.user = this.server.create('user', {
scope: instances.scopes.global,
});
urls.groups = '/scopes/global/groups';
getGroupCount = () => this.server.schema.groups.all().models.length;
});
test('it exists', function (assert) {
let controller = this.owner.lookup('controller:scopes/scope/groups/index');
assert.ok(controller);
});
test('handleSearchInput action sets expected values correctly', async function (assert) {
let controller = this.owner.lookup('controller:scopes/scope/targets/index');
const searchValue = 'group';
controller.handleSearchInput({ target: { value: searchValue } });
await waitUntil(() => controller.search === searchValue);
@@ -24,4 +63,46 @@ module('Unit | Controller | scopes/scope/groups/index', function (hooks) {
assert.strictEqual(controller.page, 1);
assert.strictEqual(controller.search, searchValue);
});
test('cancel action rolls-back changes on the specified model', async function (assert) {
await visit(urls.groups);
const group = await store.findRecord('group', instances.group.id);
group.name = 'test';
assert.strictEqual(group.name, 'test');
await controller.cancel(group);
assert.notEqual(group.name, 'test');
});
test('save action saves changes on the specified model', async function (assert) {
await visit(urls.groups);
const group = await store.findRecord('group', instances.group.id);
group.name = 'test';
await controller.save(group);
assert.strictEqual(group.name, 'test');
});
test('delete action destroys specified model', async function (assert) {
const group = await store.findRecord('group', instances.group.id);
const groupCount = getGroupCount();
await controller.delete(group);
assert.strictEqual(getGroupCount(), groupCount - 1);
});
test('removeMember action removes member from group', async function (assert) {
instances.group.update({ memberIds: [instances.user.id] });
const group = await store.findRecord('group', instances.group.id);
assert.deepEqual(group.member_ids, [instances.user.id]);
await controller.removeMember(group, instances.user);
assert.deepEqual(group.member_ids, []);
});
});
@@ -4,7 +4,7 @@
*/
import { module, test } from 'qunit';
import { setupTest } from 'admin/tests/helpers';
import { setupTest } from 'ember-qunit';
module('Unit | Controller | scopes/scope/groups/new', function (hooks) {
setupTest(hooks);
@@ -12,5 +12,6 @@ module('Unit | Controller | scopes/scope/groups/new', function (hooks) {
test('it exists', function (assert) {
let controller = this.owner.lookup('controller:scopes/scope/groups/new');
assert.ok(controller);
assert.ok(controller.groups);
});
});
@@ -50,21 +50,18 @@ module(
scope: { id: instances.scopes.org.id, type: 'org' },
});
instances.hostCatalog = this.server.create('host-catalog', {
scopeId: instances.scopes.project.id,
scope: instances.scopes.project,
});
instances.hostSet = this.server.create('host-set', {
scopeId: instances.scopes.project.id,
scope: instances.scopes.project,
hostCatalog: instances.hostCatalog,
});
instances.host = this.server.create('host', {
scopeId: instances.scopes.project.id,
scope: instances.scopes.project,
hostCatalog: instances.hostCatalog,
});
urls.globalScope = `/scopes/global`;
urls.orgScope = `/scopes/${instances.scopes.org.id}/scopes`;
urls.projectScope = `/scopes/${instances.scopes.project.id}`;
urls.addHosts = `${urls.projectScope}/host-catalogs/${instances.hostCatalog.id}/host-sets/${instances.hostSet.id}/add-hosts`;
urls.addHosts = `/scopes/${instances.scopes.project.id}/host-catalogs/${instances.hostCatalog.id}/host-sets/${instances.hostSet.id}/add-hosts`;
});
test('it exists', function (assert) {
@@ -30,7 +30,7 @@ module(
};
const urls = {
createAndAddhost: null,
createAndAddHost: null,
};
hooks.beforeEach(function () {
@@ -64,7 +64,7 @@ module(
urls.globalScope = `/scopes/global`;
urls.orgScope = `/scopes/${instances.scopes.org.id}/scopes`;
urls.projectScope = `/scopes/${instances.scopes.project.id}`;
urls.createAndAddhost = `${urls.projectScope}/host-catalogs/${instances.hostCatalog.id}/host-sets/${instances.hostSet.id}/create-and-add-host`;
urls.createAndAddHost = `${urls.projectScope}/host-catalogs/${instances.hostCatalog.id}/host-sets/${instances.hostSet.id}/create-and-add-host`;
});
test('it exists', function (assert) {
@@ -72,7 +72,7 @@ module(
});
test('cancel action rolls-back changes on the specified model', async function (assert) {
await visit(urls.createAndAddhost);
await visit(urls.createAndAddHost);
const host = await store.findRecord('host', instances.host.id);
host.name = 'test';
@@ -84,7 +84,7 @@ module(
});
test('save action saves host and adds to the specified host-set', async function (assert) {
await visit(urls.createAndAddhost);
await visit(urls.createAndAddHost);
const hostSet = await store.findRecord('host-set', instances.hostSet.id);
const host = await store.findRecord('host', instances.host.id);
host.name = 'test';
@@ -16,6 +16,7 @@ module(
'controller:scopes/scope/host-catalogs/host-catalog/host-sets/host-set/hosts/index',
);
assert.ok(controller);
assert.ok(controller.hostSets);
});
},
);
@@ -16,6 +16,7 @@ module(
'controller:scopes/scope/host-catalogs/host-catalog/host-sets/host-set/index',
);
assert.ok(controller);
assert.ok(controller.hostSets);
});
},
);
@@ -7,6 +7,7 @@ import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { visit } from '@ember/test-helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIntl } from 'ember-intl/test-support';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import { authenticateSession } from 'ember-simple-auth/test-support';
@@ -16,6 +17,7 @@ module(
setupTest(hooks);
setupMirage(hooks);
setupIndexedDb(hooks);
setupIntl(hooks, 'en-us');
let store;
let controller;
@@ -52,23 +54,20 @@ module(
scope: { id: instances.scopes.org.id, type: 'org' },
});
instances.hostCatalog = this.server.create('host-catalog', {
scopeId: instances.scopes.project.id,
scope: instances.scopes.project,
});
instances.hostSet = this.server.create('host-set', {
scopeId: instances.scopes.project.id,
hostCatalog: instances.hostCatalog,
});
urls.globalScope = `/scopes/global`;
urls.orgScope = `/scopes/${instances.scopes.org.id}/scopes`;
urls.projectScope = `/scopes/${instances.scopes.project.id}`;
urls.hostSets = `${urls.projectScope}/host-catalogs/${instances.hostCatalog.id}/host-sets`;
urls.hostSets = `/scopes/${instances.scopes.project.id}/host-catalogs/${instances.hostCatalog.id}/host-sets`;
getHostSetCount = () => this.server.schema.hostSets.all().models.length;
});
test('it exists', function (assert) {
assert.ok(controller);
assert.ok(controller.hostCatalogs);
});
test('cancel action rolls-back changes on the specified model', async function (assert) {
@@ -94,7 +93,6 @@ module(
});
test('delete action destroys specified model', async function (assert) {
await visit(urls.projectScope);
const hostSet = await store.findRecord('host-set', instances.hostSet.id);
const hostSetCount = getHostSetCount();
@@ -4,7 +4,7 @@
*/
import { module, test } from 'qunit';
import { setupTest } from 'admin/tests/helpers';
import { setupTest } from 'ember-qunit';
module(
'Unit | Controller | scopes/scope/host-catalogs/host-catalog/host-sets/new',
@@ -16,6 +16,7 @@ module(
'controller:scopes/scope/host-catalogs/host-catalog/host-sets/new',
);
assert.ok(controller);
assert.ok(controller.hostSets);
});
},
);
@@ -16,6 +16,7 @@ module(
'controller:scopes/scope/host-catalogs/host-catalog/hosts/host/index',
);
assert.ok(controller);
assert.ok(controller.hosts);
});
},
);
@@ -69,6 +69,7 @@ module(
test('it exists', function (assert) {
assert.ok(controller);
assert.ok(controller.hostCatalogs);
});
test('cancel action rolls-back changes on the specified model', async function (assert) {
@@ -16,6 +16,7 @@ module(
'controller:scopes/scope/host-catalogs/host-catalog/hosts/new',
);
assert.ok(controller);
assert.ok(controller.hosts);
});
},
);
@@ -16,6 +16,7 @@ module(
'controller:scopes/scope/host-catalogs/host-catalog/index',
);
assert.ok(controller);
assert.ok(controller.hostCatalogs);
});
},
);
@@ -5,6 +5,7 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { setupIntl } from 'ember-intl/test-support';
import { waitUntil, visit } from '@ember/test-helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
@@ -16,6 +17,7 @@ module(
setupTest(hooks);
setupMirage(hooks);
setupIndexedDb(hooks);
setupIntl(hooks, 'en-us');
let store;
let controller;
@@ -51,13 +53,10 @@ module(
scope: { id: instances.scopes.org.id, type: 'org' },
});
instances.hostCatalog = this.server.create('host-catalog', {
scopeId: instances.scopes.project.id,
scope: instances.scopes.project,
});
urls.globalScope = `/scopes/global`;
urls.orgScope = `/scopes/${instances.scopes.org.id}/scopes`;
urls.projectScope = `/scopes/${instances.scopes.project.id}`;
urls.hostCatalogs = `${urls.projectScope}/host-catalogs`;
urls.hostCatalogs = `scopes/${instances.scopes.project.id}/host-catalogs`;
getHostCatalogCount = () =>
this.server.schema.hostCatalogs.all().models.length;
@@ -105,7 +104,6 @@ module(
});
test('delete action destroys specified model', async function (assert) {
await visit(urls.projectScope);
const hostCatalog = await store.findRecord(
'host-catalog',
instances.hostCatalog.id,
@@ -14,5 +14,6 @@ module('Unit | Controller | scopes/scope/host-catalogs/new', function (hooks) {
'controller:scopes/scope/host-catalogs/new',
);
assert.ok(controller);
assert.ok(controller.hostCatalogs);
});
});
@@ -7,6 +7,7 @@ import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { visit } from '@ember/test-helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIntl } from 'ember-intl/test-support';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import { authenticateSession } from 'ember-simple-auth/test-support';
@@ -14,6 +15,7 @@ module('Unit | Controller | scopes/scope/policies/index', function (hooks) {
setupTest(hooks);
setupMirage(hooks);
setupIndexedDb(hooks);
setupIntl(hooks, 'en-us');
let store;
let controller;
@@ -27,7 +29,6 @@ module('Unit | Controller | scopes/scope/policies/index', function (hooks) {
};
const urls = {
globalScope: null,
policies: null,
};
@@ -41,8 +42,7 @@ module('Unit | Controller | scopes/scope/policies/index', function (hooks) {
scopeId: 'global',
});
urls.globalScope = `/scopes/global`;
urls.policies = `${urls.globalScope}/policies`;
urls.policies = '/scopes/global/policies';
getPolicyCount = () => this.server.schema.policies.all().models.length;
});
@@ -77,7 +77,6 @@ module('Unit | Controller | scopes/scope/policies/index', function (hooks) {
});
test('delete action destroys specified model', async function (assert) {
await visit(urls.globalScope);
const policy = await store.findRecord('policy', instances.policy.id);
const policyCount = getPolicyCount();
@@ -12,5 +12,6 @@ module('Unit | Controller | scopes/scope/policies/new', function (hooks) {
test('it exists', function (assert) {
let controller = this.owner.lookup('controller:scopes/scope/policies/new');
assert.ok(controller);
assert.ok(controller.policies);
});
});
@@ -16,6 +16,7 @@ module(
'controller:scopes/scope/policies/policy/index',
);
assert.ok(controller);
assert.ok(controller.policies);
});
},
);
@@ -41,10 +41,10 @@ module('Unit | Controller | scopes/scope/roles/index', function (hooks) {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.role = this.server.create('role', {
scopeId: 'global',
scope: instances.scopes.global,
});
instances.user = this.server.create('user', {
scopeId: 'global',
scope: instances.scopes.global,
});
urls.globalScope = `/scopes/global`;
@@ -12,5 +12,6 @@ module('Unit | Controller | scopes/scope/roles/new', function (hooks) {
test('it exists', function (assert) {
let controller = this.owner.lookup('controller:scopes/scope/roles/new');
assert.ok(controller);
assert.ok(controller.roles);
});
});
@@ -29,7 +29,6 @@ module(
};
const urls = {
globalScope: null,
addPrincipals: null,
};
@@ -56,8 +55,7 @@ module(
scopeId: 'global',
});
urls.globalScope = `/scopes/global`;
urls.addPrincipals = `${urls.globalScope}/roles/${instances.role.id}/add-principals`;
urls.addPrincipals = `/scopes/global/roles/${instances.role.id}/add-principals`;
});
test('it exists', function (assert) {
@@ -24,7 +24,6 @@ module('Unit | Controller | scopes/scope/roles/role/grants', function (hooks) {
};
const urls = {
globalScope: null,
grants: null,
};
@@ -35,15 +34,15 @@ module('Unit | Controller | scopes/scope/roles/role/grants', function (hooks) {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.role = this.server.create('role', {
scopeId: 'global',
scope: instances.scopes.global,
});
urls.globalScope = `/scopes/global`;
urls.grants = `${urls.globalScope}/roles/${instances.role.id}/grants`;
urls.grants = `/scopes/global/roles/${instances.role.id}/grants`;
});
test('it exists', function (assert) {
assert.ok(controller);
assert.ok(controller.roles);
});
test('cancel action rolls-back changes on the specified model', async function (assert) {
@@ -14,5 +14,6 @@ module('Unit | Controller | scopes/scope/roles/role/index', function (hooks) {
'controller:scopes/scope/roles/role/index',
);
assert.ok(controller);
assert.ok(controller.roles);
});
});
@@ -58,6 +58,7 @@ module(
test('it exists', function (assert) {
assert.ok(controller);
assert.ok(controller.manageScopes);
});
test('handleSearchInput action sets expected values correctly', async function (assert) {
@@ -66,6 +66,7 @@ module(
test('it exists', function (assert) {
assert.ok(controller);
assert.ok(controller.manageScopes);
});
test('handleSearchInput action sets expected values correctly', async function (assert) {
@@ -16,6 +16,7 @@ module(
'controller:scopes/scope/roles/role/principals',
);
assert.ok(controller);
assert.ok(controller.roles);
});
},
);
@@ -33,7 +33,6 @@ module('Unit | Controller | scopes/scope/roles/role/scopes', function (hooks) {
};
const urls = {
globalScope: null,
scopes: null,
};
@@ -46,8 +45,7 @@ module('Unit | Controller | scopes/scope/roles/role/scopes', function (hooks) {
scopeId: 'global',
});
urls.globalScope = `/scopes/global`;
urls.scopes = `${urls.globalScope}/roles/${instances.role.id}/scopes`;
urls.scopes = `/scopes/global/roles/${instances.role.id}/scopes`;
});
test('it exists', function (assert) {
@@ -48,6 +48,10 @@ module(
this.server.schema.sessionRecordings.all().models.length;
});
test('it exists', function (assert) {
assert.ok(controller);
});
test('isSessionInprogressWithNoConnections returns true if session has started with no connections', function (assert) {
const sessionRecording = store.createRecord('session-recording', {
state: STATE_SESSION_RECORDING_STARTED,
@@ -4,19 +4,96 @@
*/
import { module, test } from 'qunit';
import { setupTest } from 'admin/tests/helpers';
import { setupTest } from 'ember-qunit';
import { visit } from '@ember/test-helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import { setupIntl } from 'ember-intl/test-support';
import { authenticateSession } from 'ember-simple-auth/test-support';
module(
'Unit | Controller | scopes/scope/storage-buckets/index',
function (hooks) {
setupTest(hooks);
setupMirage(hooks);
setupIndexedDb(hooks);
setupIntl(hooks, 'en-us');
// TODO: Replace this with your real tests.
test('it exists', function (assert) {
let controller = this.owner.lookup(
let store;
let controller;
let getStorageBucketCount;
const instances = {
scopes: {
global: null,
},
storageBucket: null,
};
const urls = {
storageBuckets: null,
};
hooks.beforeEach(function () {
authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/storage-buckets/index',
);
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.storageBucket = this.server.create('storage-bucket', {
scope: instances.scopes.global,
});
urls.storageBuckets = '/scopes/global/storage-buckets';
getStorageBucketCount = () =>
this.server.schema.storageBuckets.all().models.length;
});
test('it exists', function (assert) {
assert.ok(controller);
});
test('cancel action rolls-back changes on the specified model', async function (assert) {
await visit(urls.storageBuckets);
const storageBucket = await store.findRecord(
'storage-bucket',
instances.storageBucket.id,
);
storageBucket.name = 'test';
assert.strictEqual(storageBucket.name, 'test');
await controller.cancel(storageBucket);
assert.notEqual(storageBucket.name, 'test');
});
test('save action saves changes on the specified model', async function (assert) {
await visit(urls.storageBuckets);
const storageBucket = await store.findRecord(
'storage-bucket',
instances.storageBucket.id,
);
storageBucket.name = 'test';
await controller.save(storageBucket);
assert.strictEqual(storageBucket.name, 'test');
});
test('delete action destroys specified model', async function (assert) {
const storageBucket = await store.findRecord(
'storage-bucket',
instances.storageBucket.id,
);
const storageBucketCount = getStorageBucketCount();
await controller.delete(storageBucket);
assert.strictEqual(getStorageBucketCount(), storageBucketCount - 1);
});
},
);
@@ -4,19 +4,19 @@
*/
import { module, test } from 'qunit';
import { setupTest } from 'admin/tests/helpers';
import { setupTest } from 'ember-qunit';
module(
'Unit | Controller | scopes/scope/storage-buckets/new',
function (hooks) {
setupTest(hooks);
// TODO: Replace this with your real tests.
test('it exists', function (assert) {
let controller = this.owner.lookup(
'controller:scopes/scope/storage-buckets/new',
);
assert.ok(controller);
assert.ok(controller.storageBuckets);
});
},
);
@@ -4,19 +4,19 @@
*/
import { module, test } from 'qunit';
import { setupTest } from 'admin/tests/helpers';
import { setupTest } from 'ember-qunit';
module(
'Unit | Controller | scopes/scope/storage-buckets/storage-bucket/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/storage-buckets/storage-bucket/index',
);
assert.ok(controller);
assert.ok(controller.storageBuckets);
});
},
);
@@ -12,5 +12,6 @@ module('Unit | Controller | scopes/scope/targets/new', function (hooks) {
test('it exists', function (assert) {
const controller = this.owner.lookup('controller:scopes/scope/targets/new');
assert.ok(controller);
assert.ok(controller.targets);
});
});
@@ -16,6 +16,7 @@ module(
'controller:scopes/scope/targets/target/brokered-credential-sources',
);
assert.ok(controller);
assert.ok(controller.targets);
});
},
);
@@ -16,6 +16,7 @@ module(
'controller:scopes/scope/targets/target/create-alias',
);
assert.ok(controller);
assert.ok(controller.targets);
});
},
);
@@ -16,6 +16,7 @@ module(
'controller:scopes/scope/targets/target/edit-egress-worker-filter',
);
assert.ok(controller);
assert.ok(controller.targets);
});
},
);
@@ -16,6 +16,7 @@ module(
'controller:scopes/scope/targets/target/edit-ingress-worker-filter',
);
assert.ok(controller);
assert.ok(controller.targets);
});
},
);
@@ -62,6 +62,7 @@ module(
test('it exists', function (assert) {
assert.ok(controller);
assert.ok(controller.storageBuckets);
});
test('cancel action rolls-back changes on the specified model', async function (assert) {
@@ -58,6 +58,7 @@ module(
test('it exists', function (assert) {
assert.ok(controller);
assert.ok(controller.targets);
});
test('cancel action rolls-back changes on the specified model', async function (assert) {
@@ -16,6 +16,7 @@ module(
'controller:scopes/scope/targets/target/host-sources',
);
assert.ok(controller);
assert.ok(controller.targets);
});
},
);
@@ -16,6 +16,7 @@ module(
'controller:scopes/scope/targets/target/injected-application-credential-sources',
);
assert.ok(controller);
assert.ok(controller.targets);
});
},
);
@@ -16,6 +16,7 @@ module(
'controller:scopes/scope/targets/target/manage-alias',
);
assert.ok(controller);
assert.ok(controller.targets);
});
},
);
@@ -16,6 +16,7 @@ module(
'controller:scopes/scope/targets/target/workers',
);
assert.ok(controller);
assert.ok(controller.targets);
});
},
);
@@ -30,7 +30,6 @@ module('Unit | Controller | scopes/scope/users/index', function (hooks) {
};
const urls = {
globalScope: null,
users: null,
};
@@ -47,8 +46,7 @@ module('Unit | Controller | scopes/scope/users/index', function (hooks) {
scope: instances.scopes.global,
});
urls.globalScope = `/scopes/global`;
urls.users = `${urls.globalScope}/users`;
urls.users = '/scopes/global/users';
getUserCount = () => this.server.schema.users.all().models.length;
});
@@ -12,5 +12,6 @@ module('Unit | Controller | scopes/scope/users/new', function (hooks) {
test('it exists', function (assert) {
let controller = this.owner.lookup('controller:scopes/scope/users/new');
assert.ok(controller);
assert.ok(controller.users);
});
});
@@ -16,6 +16,7 @@ module(
'controller:scopes/scope/users/user/accounts',
);
assert.ok(controller);
assert.ok(controller.users);
});
},
);
@@ -14,5 +14,6 @@ module('Unit | Controller | scopes/scope/users/user/index', function (hooks) {
'controller:scopes/scope/users/user/index',
);
assert.ok(controller);
assert.ok(controller.users);
});
});
@@ -24,7 +24,6 @@ module('Unit | Controller | scopes/scope/workers/new', function (hooks) {
};
const urls = {
globalScope: null,
workers: null,
};
@@ -38,8 +37,7 @@ module('Unit | Controller | scopes/scope/workers/new', function (hooks) {
scope: instances.scopes.global,
});
urls.globalScope = `/scopes/global`;
urls.workers = `${urls.globalScope}/workers`;
urls.workers = '/scopes/global/workers';
});
test('it exists', function (assert) {
@@ -0,0 +1,22 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module(
'Unit | Controller | scopes/scope/workers/worker/index',
function (hooks) {
setupTest(hooks);
test('it exists', function (assert) {
let controller = this.owner.lookup(
'controller:scopes/scope/workers/worker/index',
);
assert.ok(controller);
assert.ok(controller.workers);
});
},
);
@@ -52,6 +52,7 @@ module(
test('it exists', function (assert) {
assert.ok(controller);
assert.ok(controller.workers);
});
test('tagDisplayName returns the display name of the tag', function (assert) {