Files
threshold-ui/ui/admin/tests/unit/abilities/collection-test.js
T
Carlos Alcaide Corvo b51c8203ee chore: 🤖 Upgrade eslint-plugin-qunit (#2011)
* chore: 🤖 Upgrade eslint-plugin-qunit

* Delete unnecessary assert.expect from tests
2023-12-08 12:56:00 -08:00

28 lines
1017 B
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
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:can');
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' }));
});
});