* [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>
34 lines
1.1 KiB
JavaScript
34 lines
1.1 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 | Host Set', function (hooks) {
|
|
setupTest(hooks);
|
|
|
|
test('it reflects when a given host set resource may add hosts based on authorized_actions', function (assert) {
|
|
assert.expect(2);
|
|
const service = this.owner.lookup('service:can');
|
|
const model = {
|
|
authorized_actions: ['add-hosts'],
|
|
};
|
|
assert.ok(service.can('addHosts hostSet', model));
|
|
model.authorized_actions = [];
|
|
assert.notOk(service.can('addHosts hostSet', model));
|
|
});
|
|
|
|
test('it reflects when a given hostSet resource may remove hosts based on authorized_actions', function (assert) {
|
|
assert.expect(2);
|
|
const service = this.owner.lookup('service:can');
|
|
const model = {
|
|
authorized_actions: ['remove-hosts'],
|
|
};
|
|
assert.ok(service.can('removeHosts hostSet', model));
|
|
model.authorized_actions = [];
|
|
assert.notOk(service.can('removeHosts hostSet', model));
|
|
});
|
|
});
|