Files
threshold-ui/addons/api/tests/unit/abilities/session-recording-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

53 lines
1.2 KiB
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Ability | session-recording', function (hooks) {
setupTest(hooks);
let canService;
let store;
hooks.beforeEach(function () {
canService = this.owner.lookup('service:can');
store = this.owner.lookup('service:store');
});
test('it exists', function (assert) {
const ability = this.owner.lookup('ability:session-recording');
assert.ok(ability);
});
test('can download when a recording has download authorization', function (assert) {
const recordingWithAuthorizedAction = store.createRecord(
'session-recording',
{
authorized_actions: ['download'],
},
);
const recordingWithoutAuthorizedAction = store.createRecord(
'session-recording',
{
authorized_actions: [],
},
);
assert.true(
canService.can(
'download session-recording',
recordingWithAuthorizedAction,
),
);
assert.false(
canService.can(
'download session-recording',
recordingWithoutAuthorizedAction,
),
);
});
});