diff --git a/front/core/components/chip/index.spec.js b/front/core/components/chip/index.spec.js index fc93527d6..36b0b4352 100644 --- a/front/core/components/chip/index.spec.js +++ b/front/core/components/chip/index.spec.js @@ -18,9 +18,14 @@ describe('Component vnChip', () => { it(`should emit remove event`, () => { controller.emit = () => {}; jest.spyOn(controller, 'emit'); - controller.onRemove(); - expect(controller.emit).toHaveBeenCalledWith('remove'); + const $event = new Event('click'); + const target = document.createElement('div'); + target.dispatchEvent($event); + + controller.onRemove($event); + + expect(controller.emit).toHaveBeenCalledWith('remove', {$event}); }); }); }); diff --git a/modules/worker/front/time-control/index.spec.js b/modules/worker/front/time-control/index.spec.js index 4e9730d9c..920f13e7c 100644 --- a/modules/worker/front/time-control/index.spec.js +++ b/modules/worker/front/time-control/index.spec.js @@ -113,5 +113,21 @@ describe('Component vnWorkerTimeControl', () => { expect(result).toEqual('01:00'); }); }); + + describe('save() ', () => { + it(`should make a query an then call to the fetchHours() method`, () => { + controller.fetchHours = jest.fn(); + controller.selectedRow = {id: 1, timed: new Date(), direction: 'in'}; + controller.$.editEntry = { + hide: () => {} + }; + const expectedParams = {direction: 'in'}; + $httpBackend.expect('POST', 'WorkerTimeControls/1/updateTimeEntry', expectedParams).respond(200); + controller.save(); + $httpBackend.flush(); + + expect(controller.fetchHours).toHaveBeenCalledWith(); + }); + }); }); });