feat: add frontTest for calendar
gitea/salix/pipeline/head This commit is unstable Details

This commit is contained in:
Vicent Llopis 2022-06-10 08:29:10 +02:00
parent f6ab9d8a31
commit 06f181e913
1 changed files with 17 additions and 2 deletions

View File

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