fix: 🐛 Fix isAsciicast check (#301)

✅ Closes: ICU-9511
This commit is contained in:
Zhihe Li authored and GitHub committed 2023-05-31 15:27:30 -04:00
1 parent 2cd4995c92
commit 4ac6259d2a
2 files changed
+14 -1

No files matched your search

+1 -1
View File
@@ -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;
}
/**
@@ -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);
});
});