* [COMPLIANCE] Add Copyright and License Headers * chore: 🤖 update Copyright headers to satisfy our lint rules --------- Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com> Co-authored-by: Cameron Perera <cameron.perera@hashicorp.com>
29 lines
1.0 KiB
JavaScript
29 lines
1.0 KiB
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) {
|
|
assert.expect(4);
|
|
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' }));
|
|
});
|
|
});
|