Skip to content

Commit

Permalink
fix: Failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
Jasenkoo committed May 22, 2024
1 parent fbbe86f commit 22346de
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tests/unit/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ const getMinMax = () => {
return { minDate, maxDate };
};

const getMapDatesOpts = (date: Date, timezone: TimeZoneConfig) => {
const highlightFn = (date: any) => !!date;
const getMapDatesOpts = (date: Date, timezone: TimeZoneConfig, highlightFn: (date: any) => boolean) => {
return {
minDate: date,
maxDate: date,
Expand Down Expand Up @@ -448,7 +447,9 @@ describe('Utils and date utils formatting', () => {
it('Should map propDates value with and without timezone', async () => {
const today = resetDateTime(new Date());
const highlightFn = (date: any) => !!date;
const mappedDates = mapPropDates(getMapDatesOpts(today, { timezone: undefined, exactMatch: false }));
const mappedDates = mapPropDates(
getMapDatesOpts(today, { timezone: undefined, exactMatch: false }, highlightFn),
);

expect(mappedDates.maxDate).toEqual(today);
expect(mappedDates.minDate).toEqual(today);
Expand All @@ -457,7 +458,9 @@ describe('Utils and date utils formatting', () => {
expect(mappedDates.highlight).toEqual(highlightFn);

const todayInTz = localToTz(today, 'UTC');
const mappedDatesInTimezone = mapPropDates(getMapDatesOpts(today, { timezone: 'UTC', exactMatch: false }));
const mappedDatesInTimezone = mapPropDates(
getMapDatesOpts(today, { timezone: 'UTC', exactMatch: false }, highlightFn),
);

expect(mappedDatesInTimezone.maxDate).toEqual(todayInTz);
expect(mappedDatesInTimezone.minDate).toEqual(todayInTz);
Expand Down

0 comments on commit 22346de

Please sign in to comment.