Files
threshold-ui/ui/admin/tests/unit/abilities/collection-test.js
T
hashiccandLisbet Alvarez 3a847605ed Reapply ember-can upgrade (#3111)
* chore: 🤖 reapply previous ember-can upgrade from #3093

* chore: 🤖 add missing ember-inflector dependency

* chore: 🤖 move @ember/string to be a dependency in desktop

* chore: 🤖 re-run pnpm install to resolve lockfile dupe key error

* chore: 🤖 remove unused abilities service injections

Co-Authored-By: Lisbet Alvarez <107949262+lisbet-alvarez@users.noreply.github.com>

---------

Co-authored-by: Lisbet Alvarez <107949262+lisbet-alvarez@users.noreply.github.com>
2026-02-24 13:48:34 -05:00

28 lines
1.0 KiB
JavaScript

/**
* Copyright IBM Corp. 2021, 2026
* SPDX-License-Identifier: BUSL-1.1
*/
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Abilities | model', function (hooks) {
setupTest(hooks);
test('it reflects when a resource may be navigated to based on list and create actions', function (assert) {
const service = this.owner.lookup('service:abilities');
const model = {
authorized_collection_actions: { foobars: [] },
};
assert.notOk(
service.can('navigate model', model, { collection: 'foobars' }),
);
model.authorized_collection_actions.foobars = ['list'];
assert.ok(service.can('navigate model', model, { collection: 'foobars' }));
model.authorized_collection_actions.foobars = ['create'];
assert.ok(service.can('navigate model', model, { collection: 'foobars' }));
model.authorized_collection_actions.foobars = ['list', 'create'];
assert.ok(service.can('navigate model', model, { collection: 'foobars' }));
});
});