Files
threshold-ui/addons/core/tests/unit/utils/param-value-finder-test.js
T
Lisbet Alvarez b1b49edb39 Refactor hds side nav to hds app side nav and header (#3032)
* refactor: 💡 use hds app header and app side nav

* style: 💄 fix dark-mode colors for side nav and app header

* style: 💄 cleanup

* style: 💄 simplify selector

* refactor: 💡 move util (param finder) to core addon

* refactor: 💡 move scope picker to core addon

* refactor: 💡 use hds header and app side nav in ui/desktop

* refactor: 💡 clean up ui/desktop files

* refactor: 💡 remove uneeded header components

* refactor: 💡 remove uneeded global layout

* Add missing copyright headers

* style: 💄 adjust foreground and background colors to fix contras

* style: 💄 remove uneeded stylelint disables

* style: 💄 fix dark mode styling in desktop ui

* refactor: 💡 readd user-select style

* test: 💍 fix tests + e2e tests for admin and desktop UIs

* refactor: 💡 clean up uneeded main elements and fix color link

* Add missing copyright headers

* fix: 🐛 e2e test selectors for ui/desktop

* style: 💄 revert link color change

* refactor: 💡 remove hds override

* fix: 🐛 scope dropdown for desktop

* fix: 🐛 max-height to desktop scope dropdown

* Add missing copyright headers

* chore: 🤖 update lockfile due to webpack update
2026-02-25 13:55:36 -08:00

56 lines
1.6 KiB
JavaScript

/**
* Copyright IBM Corp. 2021, 2026
* SPDX-License-Identifier: BUSL-1.1
*/
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { paramValueFinder } from 'core/utils/param-value-finder';
module('Unit | Utility | param-value-finder', function (hooks) {
setupTest(hooks);
test('returns empty array when null or empty routeInfo object is used', function (assert) {
let result = paramValueFinder('scopes', null);
assert.deepEqual(result, []);
result = paramValueFinder('scopes', {});
assert.deepEqual(result, []);
});
test('returns correct array when routeInfo object is used', function (assert) {
// Route being tested is '/scopes'
const application = { localName: 'application', params: {}, parent: null };
const scopes = { localName: 'scopes', params: {}, parent: application };
const scopesIndex = {
localName: 'index',
name: 'scopes.index',
parent: scopes,
};
let result = paramValueFinder('scopes', scopesIndex.parent);
assert.deepEqual(result, []);
// Route being tested is '/scopes/global/auth-methods'
const scope = {
localName: 'scope',
params: { scope_id: 'global' },
parent: scopes,
};
const authMethods = {
localName: 'auth-methods',
params: {},
parent: scope,
};
const authMethodsIndex = {
localName: 'index',
name: 'scopes.scope.auth-methods.index',
parent: authMethods,
};
result = paramValueFinder('scopes', authMethodsIndex.parent);
assert.deepEqual(result, ['global']);
});
});