* 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>
59 lines
1.5 KiB
JavaScript
59 lines
1.5 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 | Worker', function (hooks) {
|
|
setupTest(hooks);
|
|
|
|
let abilitiesService;
|
|
let store;
|
|
|
|
const instances = {
|
|
worker: null,
|
|
};
|
|
|
|
hooks.beforeEach(function () {
|
|
abilitiesService = this.owner.lookup('service:abilities');
|
|
store = this.owner.lookup('service:store');
|
|
instances.worker = store.createRecord('worker');
|
|
});
|
|
|
|
test('can create worker-led', function (assert) {
|
|
const model = {
|
|
authorized_collection_actions: { workers: ['create:worker-led'] },
|
|
};
|
|
assert.true(
|
|
abilitiesService.can('createWorkerLed worker', model, {
|
|
collection: 'workers',
|
|
}),
|
|
);
|
|
});
|
|
|
|
test('cannot create worker-led', function (assert) {
|
|
const model = {
|
|
authorized_collection_actions: { workers: [] },
|
|
};
|
|
assert.true(
|
|
abilitiesService.cannot('createWorkerLed worker', model, {
|
|
collection: 'workers',
|
|
}),
|
|
);
|
|
});
|
|
|
|
test('can set worker tags', function (assert) {
|
|
instances.worker.authorized_actions = ['set-worker-tags'];
|
|
assert.true(abilitiesService.can('setWorkerTags worker', instances.worker));
|
|
});
|
|
|
|
test('cannot set worker tags', function (assert) {
|
|
instances.worker.authorized_actions = [];
|
|
assert.true(
|
|
abilitiesService.cannot('setWorkerTags worker', instances.worker),
|
|
);
|
|
});
|
|
});
|