Files
threshold-ui/addons/api/tests/unit/models/channel-test.js
T

39 lines
1.2 KiB
JavaScript
Raw Normal View History

2023-03-07 16:38:41 -05:00
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { TYPE_CHANNEL_SESSION } from 'api/models/channel';
module('Unit | Model | channel', function (hooks) {
setupTest(hooks);
test('it exists', function (assert) {
let store = this.owner.lookup('service:store');
let model = store.createRecord('channel', {});
assert.ok(model);
});
test('it has isUnknown property and returns the expected values', async function (assert) {
assert.expect(2);
const store = this.owner.lookup('service:store');
const modelA = store.createRecord('channel', {
type: TYPE_CHANNEL_SESSION,
});
const modelB = store.createRecord('channel', {
type: 'no-such-type',
});
assert.false(modelA.isUnknown);
assert.true(modelB.isUnknown);
});
test('it has isSession property and returns the expected values', async function (assert) {
assert.expect(2);
const store = this.owner.lookup('service:store');
const modelA = store.createRecord('channel', {
type: TYPE_CHANNEL_SESSION,
});
const modelB = store.createRecord('channel', {
type: 'random',
});
assert.true(modelA.isSession);
assert.false(modelB.isSession);
});
});