From 06f181e913ac9a7e733a160dc849d061b0f4b2e2 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 10 Jun 2022 08:29:10 +0200 Subject: [PATCH] feat: add frontTest for calendar --- modules/zone/front/calendar/index.spec.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/modules/zone/front/calendar/index.spec.js b/modules/zone/front/calendar/index.spec.js index 990ecd32e..338f47917 100644 --- a/modules/zone/front/calendar/index.spec.js +++ b/modules/zone/front/calendar/index.spec.js @@ -58,7 +58,7 @@ describe('component vnZoneCalendar', () => { }); describe('data() setter', () => { - it('should set the events and exclusions and then call the refreshEvents() method', () => { + it('should set the events, exclusions and geoExclusions and then call the refreshEvents() method', () => { jest.spyOn(controller, 'refreshEvents').mockReturnThis(); controller.data = { @@ -67,13 +67,17 @@ describe('component vnZoneCalendar', () => { }], events: [{ dated: new Date() - }] + }], + geoExclusions: [{ + dated: new Date() + }], }; expect(controller.refreshEvents).toHaveBeenCalledWith(); expect(controller.events).toBeDefined(); expect(controller.events.length).toEqual(1); expect(controller.exclusions).toBeDefined(); + expect(controller.geoExclusions).toBeDefined(); expect(Object.keys(controller.exclusions).length).toEqual(1); }); }); @@ -153,5 +157,16 @@ describe('component vnZoneCalendar', () => { expect(result).toEqual('excluded'); }); + + it('should return the className "geoExcluded" for a date with geo excluded', () => { + const dated = new Date(); + + controller.geoExclusions = []; + controller.geoExclusions[dated.getTime()] = true; + + const result = controller.getClass(dated); + + expect(result).toEqual('geoExcluded'); + }); }); });