From b9f89e93f6b6e02aaf720469debcf317b9a1102b Mon Sep 17 00:00:00 2001 From: Samson Akol Date: Wed, 7 Sep 2022 21:55:13 +0300 Subject: [PATCH] adds pr review comments --- .../frontend/channelEdit/views/files/FileUploadItem.vue | 2 +- .../views/files/__tests__/fileUploadItem.spec.js | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/contentcuration/contentcuration/frontend/channelEdit/views/files/FileUploadItem.vue b/contentcuration/contentcuration/frontend/channelEdit/views/files/FileUploadItem.vue index 490d01fdd4..c83f68cd4f 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/views/files/FileUploadItem.vue +++ b/contentcuration/contentcuration/frontend/channelEdit/views/files/FileUploadItem.vue @@ -136,7 +136,7 @@ }, formattedFileDisplay() { const fileName = this.fileDisplay.original_filename; - if (fileName === 'file' || (fileName && !fileName.length)) { + if (fileName === 'file' || !fileName) { return this.$tr('unknownFile'); } return fileName; diff --git a/contentcuration/contentcuration/frontend/channelEdit/views/files/__tests__/fileUploadItem.spec.js b/contentcuration/contentcuration/frontend/channelEdit/views/files/__tests__/fileUploadItem.spec.js index b21d947b19..59e8fe2f9a 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/views/files/__tests__/fileUploadItem.spec.js +++ b/contentcuration/contentcuration/frontend/channelEdit/views/files/__tests__/fileUploadItem.spec.js @@ -31,12 +31,18 @@ describe('fileUploadItem', () => { describe('render', () => { it("'Unknown filename' should be displayed if original_filename is 'file'", () => { let file = { - id: 'file-1', original_filename: 'file', }; let wrapper = makeWrapper({}, file); expect(wrapper.find('[data-test="file-link"]').text()).toBe('Unknown filename'); }); + it("'Unknown filename' should be displayed if original_filename is ''", () => { + let file = { + original_filename: '', + }; + let wrapper = makeWrapper({}, file); + expect(wrapper.find('[data-test="file-link"]').text()).toBe('Unknown filename'); + }); it("original_filename should be displayed if its value is not 'file'", () => { let file = { id: 'file-1',