From 87e0a914ade3844736ffe385740587d466e7918c Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Tue, 16 Jul 2019 14:12:58 +0200 Subject: [PATCH] fixed dms unit tests --- back/methods/dms/updateFile.js | 6 +++--- modules/client/front/dms/create/index.js | 8 ++++---- modules/client/front/dms/create/index.spec.js | 4 ++-- modules/client/front/dms/edit/index.js | 8 ++++---- modules/client/front/dms/edit/index.spec.js | 4 ++-- modules/ticket/front/dms/create/index.js | 8 ++++---- modules/ticket/front/dms/create/index.spec.js | 4 ++-- modules/ticket/front/dms/edit/index.js | 8 ++++---- modules/ticket/front/dms/edit/index.spec.js | 4 ++-- 9 files changed, 27 insertions(+), 27 deletions(-) diff --git a/back/methods/dms/updateFile.js b/back/methods/dms/updateFile.js index 32aae891b..8e21a6203 100644 --- a/back/methods/dms/updateFile.js +++ b/back/methods/dms/updateFile.js @@ -34,7 +34,7 @@ module.exports = Self => { type: 'Boolean', description: 'True if has original file' }, { - arg: 'hasAttachedFile', + arg: 'hasFileAttached', type: 'Boolean', description: 'True if has an attached file' }], @@ -49,7 +49,7 @@ module.exports = Self => { }); Self.updateFile = async(ctx, id, warehouseId, companyId, - dmsTypeId, reference, description, hasFile, hasAttachedFile, options) => { + dmsTypeId, reference, description, hasFile, hasFileAttached, options) => { const models = Self.app.models; let tx; @@ -78,7 +78,7 @@ module.exports = Self => { hasFile: hasFile }, myOptions); - if (hasAttachedFile) + if (hasFileAttached) await uploadNewFile(ctx, dms, myOptions); if (tx) await tx.commit(); diff --git a/modules/client/front/dms/create/index.js b/modules/client/front/dms/create/index.js index f3738fc2b..924e5fb26 100644 --- a/modules/client/front/dms/create/index.js +++ b/modules/client/front/dms/create/index.js @@ -11,7 +11,7 @@ class Controller { this.dms = { files: [], hasFile: false, - hasAttachedFile: false + hasFileAttached: false }; } @@ -79,12 +79,12 @@ class Controller { } onFileChange(files) { - let hasAttachedFile = false; + let hasFileAttached = false; if (files.length > 0) - hasAttachedFile = true; + hasFileAttached = true; this.$.$applyAsync(() => { - this.dms.hasAttachedFile = hasAttachedFile; + this.dms.hasFileAttached = hasFileAttached; }); } } diff --git a/modules/client/front/dms/create/index.spec.js b/modules/client/front/dms/create/index.spec.js index 2825d4d25..5ef4d28f3 100644 --- a/modules/client/front/dms/create/index.spec.js +++ b/modules/client/front/dms/create/index.spec.js @@ -48,12 +48,12 @@ describe('Client', () => { }); describe('onFileChange()', () => { - it('should set dms hasFile property to true if has any files', () => { + it('should set dms hasFileAttached property to true if has any files', () => { const files = [{id: 1, name: 'MyFile'}]; controller.onFileChange(files); $scope.$apply(); - expect(controller.dms.hasFile).toBeTruthy(); + expect(controller.dms.hasFileAttached).toBeTruthy(); }); }); }); diff --git a/modules/client/front/dms/edit/index.js b/modules/client/front/dms/edit/index.js index 00e3e4d28..be8396467 100644 --- a/modules/client/front/dms/edit/index.js +++ b/modules/client/front/dms/edit/index.js @@ -33,7 +33,7 @@ class Controller { dmsTypeId: dms.dmsTypeFk, description: dms.description, hasFile: dms.hasFile, - hasAttachedFile: false, + hasFileAttached: false, files: [] }; }); @@ -68,12 +68,12 @@ class Controller { } onFileChange(files) { - let hasAttachedFile = false; + let hasFileAttached = false; if (files.length > 0) - hasAttachedFile = true; + hasFileAttached = true; this.$.$applyAsync(() => { - this.dms.hasAttachedFile = hasAttachedFile; + this.dms.hasFileAttached = hasFileAttached; }); } } diff --git a/modules/client/front/dms/edit/index.spec.js b/modules/client/front/dms/edit/index.spec.js index 2825d4d25..5ef4d28f3 100644 --- a/modules/client/front/dms/edit/index.spec.js +++ b/modules/client/front/dms/edit/index.spec.js @@ -48,12 +48,12 @@ describe('Client', () => { }); describe('onFileChange()', () => { - it('should set dms hasFile property to true if has any files', () => { + it('should set dms hasFileAttached property to true if has any files', () => { const files = [{id: 1, name: 'MyFile'}]; controller.onFileChange(files); $scope.$apply(); - expect(controller.dms.hasFile).toBeTruthy(); + expect(controller.dms.hasFileAttached).toBeTruthy(); }); }); }); diff --git a/modules/ticket/front/dms/create/index.js b/modules/ticket/front/dms/create/index.js index 8f6f7e322..4e22a8ba5 100644 --- a/modules/ticket/front/dms/create/index.js +++ b/modules/ticket/front/dms/create/index.js @@ -11,7 +11,7 @@ class Controller { this.dms = { files: [], hasFile: false, - hasAttachedFile: false + hasFileAttached: false }; } @@ -77,12 +77,12 @@ class Controller { } onFileChange(files) { - let hasAttachedFile = false; + let hasFileAttached = false; if (files.length > 0) - hasAttachedFile = true; + hasFileAttached = true; this.$.$applyAsync(() => { - this.dms.hasAttachedFile = hasAttachedFile; + this.dms.hasFileAttached = hasFileAttached; }); } } diff --git a/modules/ticket/front/dms/create/index.spec.js b/modules/ticket/front/dms/create/index.spec.js index 1b8cdadfa..0014c010d 100644 --- a/modules/ticket/front/dms/create/index.spec.js +++ b/modules/ticket/front/dms/create/index.spec.js @@ -53,12 +53,12 @@ describe('Ticket', () => { }); describe('onFileChange()', () => { - it('should set dms hasFile property to true if has any files', () => { + it('should set dms hasFileAttached property to true if has any files', () => { const files = [{id: 1, name: 'MyFile'}]; controller.onFileChange(files); $scope.$apply(); - expect(controller.dms.hasFile).toBeTruthy(); + expect(controller.dms.hasFileAttached).toBeTruthy(); }); }); }); diff --git a/modules/ticket/front/dms/edit/index.js b/modules/ticket/front/dms/edit/index.js index df25cea94..486d37791 100644 --- a/modules/ticket/front/dms/edit/index.js +++ b/modules/ticket/front/dms/edit/index.js @@ -33,7 +33,7 @@ class Controller { dmsTypeId: dms.dmsTypeFk, description: dms.description, hasFile: dms.hasFile, - hasAttachedFile: false, + hasFileAttached: false, files: [] }; }); @@ -68,12 +68,12 @@ class Controller { } onFileChange(files) { - let hasAttachedFile = false; + let hasFileAttached = false; if (files.length > 0) - hasAttachedFile = true; + hasFileAttached = true; this.$.$applyAsync(() => { - this.dms.hasAttachedFile = hasAttachedFile; + this.dms.hasFileAttached = hasFileAttached; }); } } diff --git a/modules/ticket/front/dms/edit/index.spec.js b/modules/ticket/front/dms/edit/index.spec.js index 2825d4d25..5ef4d28f3 100644 --- a/modules/ticket/front/dms/edit/index.spec.js +++ b/modules/ticket/front/dms/edit/index.spec.js @@ -48,12 +48,12 @@ describe('Client', () => { }); describe('onFileChange()', () => { - it('should set dms hasFile property to true if has any files', () => { + it('should set dms hasFileAttached property to true if has any files', () => { const files = [{id: 1, name: 'MyFile'}]; controller.onFileChange(files); $scope.$apply(); - expect(controller.dms.hasFile).toBeTruthy(); + expect(controller.dms.hasFileAttached).toBeTruthy(); }); }); });