From 4dc4956efb4d51334e8d6178f8d012fb9f7a6fdd Mon Sep 17 00:00:00 2001 From: jerasmus Date: Thu, 18 Oct 2018 14:35:15 +0200 Subject: Fix unit tests Updated the file types for the unit tests in order for tests to pass. --- .../ide/components/new_dropdown/upload_spec.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/spec/javascripts/ide/components/new_dropdown/upload_spec.js b/spec/javascripts/ide/components/new_dropdown/upload_spec.js index 22b28cdf69e..878e17ac805 100644 --- a/spec/javascripts/ide/components/new_dropdown/upload_spec.js +++ b/spec/javascripts/ide/components/new_dropdown/upload_spec.js @@ -61,29 +61,31 @@ describe('new dropdown upload', () => { const binaryTarget = { result: 'base64,w4I=', }; - const file = { - name: 'file', + const textFile = { + name: 'textFile', type: 'text/plain', }; + const binaryFile = { + name: 'binaryFile', + type: 'image/png', + }; it('creates file in plain text (without encoding) if the file content is plain text', () => { - vm.createFile(textTarget, file); + vm.createFile(textTarget, textFile); expect(vm.$emit).toHaveBeenCalledWith('create', { - name: file.name, + name: textFile.name, type: 'blob', content: 'plain text', base64: false, }); }); - file.type = 'image/png'; - it('splits content on base64 if binary', () => { - vm.createFile(binaryTarget, file); + vm.createFile(binaryTarget, binaryFile); expect(vm.$emit).toHaveBeenCalledWith('create', { - name: file.name, + name: binaryFile.name, type: 'blob', content: binaryTarget.result.split('base64,')[1], base64: true, -- cgit v1.2.1