diff --git a/modules/client/front/balance/index/index.spec.js b/modules/client/front/balance/index/index.spec.js index e10f903d0..e044b7979 100644 --- a/modules/client/front/balance/index/index.spec.js +++ b/modules/client/front/balance/index/index.spec.js @@ -44,12 +44,6 @@ describe('Client', () => { }); describe('company setter/getter', () => { - it('should return the company', () => { - controller.companyId = null; - - expect(controller._companyId).toEqual(jasmine.any(Object)); - }); - it('should return the company and then call getData()', () => { spyOn(controller, 'getData'); controller.companyId = 442; diff --git a/modules/entry/back/methods/entry/specs/getEntry.spec.js b/modules/entry/back/methods/entry/specs/getEntry.spec.js index 4baf64543..3791a3703 100644 --- a/modules/entry/back/methods/entry/specs/getEntry.spec.js +++ b/modules/entry/back/methods/entry/specs/getEntry.spec.js @@ -5,7 +5,7 @@ describe('travel getEntry()', () => { it('should check the entry contains the id', async() => { const entry = await app.models.Entry.getEntry(entryId); - expect(entry.id).toEqual(1); + expect(entry.id).toEqual(entryId); }); it('should check the entry contains the supplier name', async() => { diff --git a/modules/entry/front/summary/index.js b/modules/entry/front/summary/index.js index 260715490..3b26907d7 100644 --- a/modules/entry/front/summary/index.js +++ b/modules/entry/front/summary/index.js @@ -16,10 +16,10 @@ class Controller extends Component { this._entry = value; if (value && value.id) - this.getEntry(); + this.getEntryData(); } - getEntry() { + getEntryData() { return this.$http.get(`/api/Entries/${this.entry.id}/getEntry`).then(response => { this.entryData = response.data; }); diff --git a/modules/entry/front/summary/index.spec.js b/modules/entry/front/summary/index.spec.js index 9a8971b52..ea4a5a7c1 100644 --- a/modules/entry/front/summary/index.spec.js +++ b/modules/entry/front/summary/index.spec.js @@ -18,28 +18,30 @@ describe('component vnEntrySummary', () => { })); describe('entry setter/getter', () => { - it('should return the entry', () => { + it('should check if value.id is defined', () => { + spyOn(controller, 'getEntryData'); + controller.entry = {id: 1}; - expect(controller.entry).toEqual(jasmine.any(Object)); + expect(controller.getEntryData).toHaveBeenCalledWith(); }); - it('should return the entry and then call getEntry()', () => { - spyOn(controller, 'getEntry'); + it('should return the entry and then call getEntryData()', () => { + spyOn(controller, 'getEntryData'); controller.entry = {id: 99}; expect(controller._entry.id).toEqual(99); - expect(controller.getEntry).toHaveBeenCalledWith(); + expect(controller.getEntryData).toHaveBeenCalledWith(); }); }); - describe('getEntry()', () => { + describe('getEntryData()', () => { it('should perform a get and then store data on the controller', () => { controller._entry = {id: 999}; const query = `/api/Entries/${controller._entry.id}/getEntry`; $httpBackend.expectGET(query).respond('I am the entryData'); - controller.getEntry(); + controller.getEntryData(); $httpBackend.flush(); expect(controller.entryData).toEqual('I am the entryData');