feat: 🎸 Add session recording models (#100)
* feat: 🎸 Add session recording models ✅ Closes: ICU-8075
This commit is contained in:
1 parent
b91b7ef4bb
commit
b9cf61932b
12 files changed
+358
No files matched your search
@@ -0,0 +1,39 @@
|
||||
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);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,23 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Model | connection', function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it exists', function (assert) {
|
||||
let store = this.owner.lookup('service:store');
|
||||
let model = store.createRecord('connection', {});
|
||||
assert.ok(model);
|
||||
});
|
||||
|
||||
test('it has channels as a relationship', async function (assert) {
|
||||
assert.expect(1);
|
||||
const store = this.owner.lookup('service:store');
|
||||
const model = store.createRecord('connection', {
|
||||
channels: [store.createRecord('channel')],
|
||||
});
|
||||
|
||||
const channels = await model.channels;
|
||||
assert.strictEqual(channels.length, 1);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,53 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
import { TYPE_RECORDING_SSH } from 'api/models/recording';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
|
||||
module('Unit | Model | recording', function (hooks) {
|
||||
setupTest(hooks);
|
||||
setupMirage(hooks);
|
||||
|
||||
test('it exists', function (assert) {
|
||||
let store = this.owner.lookup('service:store');
|
||||
let model = store.createRecord('recording', {});
|
||||
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('recording', {
|
||||
type: TYPE_RECORDING_SSH,
|
||||
});
|
||||
const modelB = store.createRecord('recording', {
|
||||
type: 'no-such-type',
|
||||
});
|
||||
assert.false(modelA.isUnknown);
|
||||
assert.true(modelB.isUnknown);
|
||||
});
|
||||
|
||||
test('it has isSSH property and returns the expected values', async function (assert) {
|
||||
assert.expect(2);
|
||||
const store = this.owner.lookup('service:store');
|
||||
const modelA = store.createRecord('recording', {
|
||||
type: TYPE_RECORDING_SSH,
|
||||
});
|
||||
const modelB = store.createRecord('recording', {
|
||||
type: 'random',
|
||||
});
|
||||
assert.true(modelA.isSSH);
|
||||
assert.false(modelB.isSSH);
|
||||
});
|
||||
|
||||
test('it has connections as a relationship', async function (assert) {
|
||||
assert.expect(1);
|
||||
const store = this.owner.lookup('service:store');
|
||||
const model = store.createRecord('recording', {
|
||||
type: TYPE_RECORDING_SSH,
|
||||
connections: [store.createRecord('connection')],
|
||||
});
|
||||
|
||||
const connections = await model.connections;
|
||||
assert.strictEqual(connections.length, 1);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user