summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjerasmus <jerasmus@gitlab.com>2018-10-18 14:35:15 +0200
committerjerasmus <jerasmus@gitlab.com>2018-10-18 14:35:15 +0200
commit4dc4956efb4d51334e8d6178f8d012fb9f7a6fdd (patch)
tree164a1615e243f636bfe6dee08efd9d96491e7d6b
parentacf18515d21601824e6438c7fb2144e4e53f9180 (diff)
downloadgitlab-ce-fix-base64-encoded-file-uploads.tar.gz
Updated the file types for the unit tests in order for tests to pass.
-rw-r--r--spec/javascripts/ide/components/new_dropdown/upload_spec.js18
1 files 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,