From a98bb59479c0ec5825a2c127e5c0ab1daefe0373 Mon Sep 17 00:00:00 2001 From: vicent Date: Mon, 6 Mar 2023 12:47:49 +0100 Subject: [PATCH] fix: test front --- front/core/components/calendar/index.spec.js | 5 +++++ modules/worker/front/time-control/index.spec.js | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/front/core/components/calendar/index.spec.js b/front/core/components/calendar/index.spec.js index c4ad6f14b..eff5a2d2d 100644 --- a/front/core/components/calendar/index.spec.js +++ b/front/core/components/calendar/index.spec.js @@ -24,10 +24,13 @@ describe('Component vnCalendar', () => { let nextMonth = new Date(date.getTime()); nextMonth.setMonth(nextMonth.getMonth() + 1); + controller.getStates = jasmine.createSpy(controller, 'getStates'); + controller.moveNext(); expect(controller.month).toEqual(nextMonth.getMonth()); expect(controller.emit).toHaveBeenCalledWith('move', {$date: nextMonth}); + expect(controller.getStates).toHaveBeenCalledWith({$day: nextMonth}); }); }); @@ -37,6 +40,8 @@ describe('Component vnCalendar', () => { let previousMonth = new Date(date.getTime()); previousMonth.setMonth(previousMonth.getMonth() - 1); + controller.getStates = jasmine.createSpy(controller, 'getStates'); + controller.movePrevious(); expect(controller.month).toEqual(previousMonth.getMonth()); diff --git a/modules/worker/front/time-control/index.spec.js b/modules/worker/front/time-control/index.spec.js index b68162d39..7c572c81c 100644 --- a/modules/worker/front/time-control/index.spec.js +++ b/modules/worker/front/time-control/index.spec.js @@ -96,8 +96,8 @@ describe('Component vnWorkerTimeControl', () => { ended.setDate(ended.getDate() + 6); controller.ended = ended; + $httpBackend.expect('GET', `WorkerTimeControlMails`).respond({data: {state: 'SENDED'}}); controller.getWorkedHours(controller.started, controller.ended); - $httpBackend.flush(); expect(controller.weekDays.length).toEqual(7);