diff --git a/addons/api/addon/models/channel-recording.js b/addons/api/addon/models/channel-recording.js index c1696f9f0..eb35df41b 100644 --- a/addons/api/addon/models/channel-recording.js +++ b/addons/api/addon/models/channel-recording.js @@ -11,7 +11,7 @@ export default class ChannelRecordingModel extends GeneratedChannelRecordingMode * @type {boolean} */ get isAsciicast() { - return this.mime_types.includes(MIME_TYPE_ASCIICAST); + return this.mime_types?.includes(MIME_TYPE_ASCIICAST) ?? false; } /** diff --git a/addons/api/tests/unit/models/channel-recording-test.js b/addons/api/tests/unit/models/channel-recording-test.js index 9cf91b116..7ee3ced5b 100644 --- a/addons/api/tests/unit/models/channel-recording-test.js +++ b/addons/api/tests/unit/models/channel-recording-test.js @@ -23,4 +23,17 @@ module('Unit | Model | channel-recording', function (hooks) { assert.true(modelA.isAsciicast); assert.false(modelB.isAsciicast); }); + + test('it has isAsciicast property and returns the expected values when mime_types are not present', async function (assert) { + assert.expect(2); + 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); + }); });