Files
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

50 lines
1.4 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 | Scope', function (hooks) {
setupTest(hooks);
let features;
let abilitiesService;
let store;
hooks.beforeEach(function () {
store = this.owner.lookup('service:store');
abilitiesService = this.owner.lookup('service:abilities');
features = this.owner.lookup('service:features');
});
test('can attach storage policy when authorized', function (assert) {
features.enable('ssh-session-recording');
const scopeModel = store.createRecord('scope', {
authorized_actions: ['attach-storage-policy'],
});
assert.true(abilitiesService.can('attachStoragePolicy scope', scopeModel));
});
test('cannot attach storage policy when unauthorized', function (assert) {
features.enable('ssh-session-recording');
const scopeModel = store.createRecord('scope', {
authorized_actions: [],
});
assert.false(abilitiesService.can('attachStoragePolicy scope', scopeModel));
});
test('can detach storage policy when authorized', function (assert) {
features.enable('ssh-session-recording');
const scopeModel = store.createRecord('scope', {
authorized_actions: ['detach-storage-policy'],
});
assert.true(abilitiesService.can('detachStoragePolicy scope', scopeModel));
});
});