fixed dms unit tests

This commit is contained in:
Joan Sanchez 2019-07-16 14:12:58 +02:00
parent 5e40b384ff
commit 87e0a914ad
9 changed files with 27 additions and 27 deletions

View File

@ -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();

View File

@ -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;
});
}
}

View File

@ -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();
});
});
});

View File

@ -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;
});
}
}

View File

@ -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();
});
});
});

View File

@ -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;
});
}
}

View File

@ -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();
});
});
});

View File

@ -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;
});
}
}

View File

@ -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();
});
});
});