Files
threshold-ui/ui/admin/tests/unit/utils/param-value-finder-test.js
T
Lisbet Alvarez 3ba93927fe Update copyright headers (#3146)
* empty commit

* Add missing copyright headers

* chore: 🤖 update copywrite config file with correct year

* Add missing copyright headers

* empty commit (gh action merge checks are stuck)
2026-01-28 17:09:06 -08:00

40 lines
1.1 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 'admin/utils/param-value-finder';
module('Unit | Utility | param-value-finder', function (hooks) {
setupTest(hooks);
let router;
hooks.beforeEach(function () {
router = this.owner.lookup('service:router');
});
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) {
let routeInfo = router.recognize('/scopes');
let result = paramValueFinder('scopes', routeInfo.parent);
assert.deepEqual(result, []);
routeInfo = router.recognize('/scopes/global/auth-methods');
result = paramValueFinder('scopes', routeInfo.parent);
assert.deepEqual(result, ['global']);
});
});