2023-06-19 16:23:53 +00:00
|
|
|
/**
|
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
2024-05-31 11:29:24 -07:00
|
|
|
* SPDX-License-Identifier: BUSL-1.1
|
2023-06-19 16:23:53 +00:00
|
|
|
*/
|
|
|
|
|
|
2023-03-07 16:38:41 -05:00
|
|
|
import { module, test } from 'qunit';
|
|
|
|
|
import { setupTest } from 'ember-qunit';
|
2023-03-31 17:19:46 -04:00
|
|
|
import { MIME_TYPE_ASCIICAST } from 'api/models/channel-recording';
|
2023-03-07 16:38:41 -05:00
|
|
|
|
2023-03-16 13:49:04 -04:00
|
|
|
module('Unit | Model | channel-recording', function (hooks) {
|
2023-03-07 16:38:41 -05:00
|
|
|
setupTest(hooks);
|
|
|
|
|
|
|
|
|
|
test('it exists', function (assert) {
|
|
|
|
|
let store = this.owner.lookup('service:store');
|
2023-03-16 13:49:04 -04:00
|
|
|
let model = store.createRecord('channel-recording', {});
|
2023-03-07 16:38:41 -05:00
|
|
|
assert.ok(model);
|
|
|
|
|
});
|
2023-03-31 17:19:46 -04:00
|
|
|
|
|
|
|
|
test('it has isAsciicast property and returns the expected values', async function (assert) {
|
|
|
|
|
const store = this.owner.lookup('service:store');
|
|
|
|
|
const modelA = store.createRecord('channel-recording', {
|
|
|
|
|
mime_types: [MIME_TYPE_ASCIICAST],
|
|
|
|
|
});
|
|
|
|
|
const modelB = store.createRecord('channel-recording', {
|
|
|
|
|
mime_types: ['random'],
|
|
|
|
|
});
|
|
|
|
|
assert.true(modelA.isAsciicast);
|
|
|
|
|
assert.false(modelB.isAsciicast);
|
|
|
|
|
});
|
2023-05-31 15:27:30 -04:00
|
|
|
|
|
|
|
|
test('it has isAsciicast property and returns the expected values when mime_types are not present', async function (assert) {
|
|
|
|
|
const store = this.owner.lookup('service:store');
|
|
|
|
|
const modelA = store.createRecord('channel-recording', {
|
|
|
|
|
mime_types: undefined,
|
|
|
|
|
});
|
|
|
|
|
const modelB = store.createRecord('channel-recording', {
|
|
|
|
|
mime_types: [],
|
|
|
|
|
});
|
|
|
|
|
assert.false(modelA.isAsciicast);
|
|
|
|
|
assert.false(modelB.isAsciicast);
|
|
|
|
|
});
|
2023-03-07 16:38:41 -05:00
|
|
|
});
|