Skip to content

Commit

Permalink
test: fixed dateScheduleDateFilter() test
Browse files Browse the repository at this point in the history
  • Loading branch information
dereekb committed Dec 3, 2022
1 parent 0e37643 commit 7c6be73
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/date/src/lib/date/date.schedule.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import { addDays } from 'date-fns';
import { range, UTC_TIMEZONE_STRING } from '@dereekb/util';

describe('dateScheduleDateFilter()', () => {
const start = new Date('2022-01-02T00:00:00Z'); // Sunday
const start = systemNormalDateToBaseDate(new Date('2022-01-02T00:00:00Z')); // Sunday

describe('function', () => {
describe('included', () => {
const dayIndexes = [0, 1, 2, 3];
const schedule: DateScheduleDateFilterConfig = { start: systemBaseDateToNormalDate(start), w: '0', d: dayIndexes };
const schedule: DateScheduleDateFilterConfig = { start, w: '0', d: dayIndexes };
const firstFourDays = dateScheduleDateFilter(schedule);

it('should allow the included days (indexes)', () => {
Expand All @@ -24,7 +24,7 @@ describe('dateScheduleDateFilter()', () => {

describe('schedule', () => {
describe('weekdays and weekends', () => {
const schedule: DateScheduleDateFilterConfig = { start: systemBaseDateToNormalDate(start), w: '89' };
const schedule: DateScheduleDateFilterConfig = { start, w: '89' };
const weekDaysAndWeekends = dateScheduleDateFilter(schedule);

it('should allow every day of the week (indexes)', () => {
Expand All @@ -45,7 +45,7 @@ describe('dateScheduleDateFilter()', () => {
});

describe('weekdays', () => {
const schedule: DateScheduleDateFilterConfig = { start: systemBaseDateToNormalDate(start), w: `${DateScheduleDayCode.WEEKDAY}` };
const schedule: DateScheduleDateFilterConfig = { start, w: `${DateScheduleDayCode.WEEKDAY}` };
const weekDays = dateScheduleDateFilter(schedule);

it('should allow every weekday (indexes)', () => {
Expand All @@ -66,7 +66,7 @@ describe('dateScheduleDateFilter()', () => {
});

describe('weekends', () => {
const schedule: DateScheduleDateFilterConfig = { start: systemBaseDateToNormalDate(start), w: `${DateScheduleDayCode.WEEKEND}` };
const schedule: DateScheduleDateFilterConfig = { start, w: `${DateScheduleDayCode.WEEKEND}` };
const weekends = dateScheduleDateFilter(schedule);

it('should allow every weekend (indexes)', () => {
Expand All @@ -85,7 +85,7 @@ describe('dateScheduleDateFilter()', () => {
});

describe('days', () => {
const schedule: DateScheduleDateFilterConfig = { start: systemBaseDateToNormalDate(start), w: `12` };
const schedule: DateScheduleDateFilterConfig = { start, w: `23` };
const mondayAndTuesdays = dateScheduleDateFilter(schedule);

it('should only allow the specified days of the week (indexes)', () => {
Expand Down Expand Up @@ -125,7 +125,7 @@ describe('dateScheduleDateFilter()', () => {
});

describe('dateScheduleDateBlockTimingFilter()', () => {
const startsAt = new Date('2022-01-02T00:00:00Z'); // Sunday
const startsAt = systemNormalDateToBaseDate(new Date('2022-01-02T00:00:00Z')); // Sunday
const weekTiming = dateBlockTiming({ startsAt, duration: 60 }, 7); // Sunday-Saturday

describe('function', () => {
Expand Down Expand Up @@ -169,7 +169,7 @@ describe('dateScheduleDateBlockTimingFilter()', () => {
});

describe('days', () => {
const schedule: DateSchedule = { w: `12` };
const schedule: DateSchedule = { w: `23` };
const mondayAndTuesdays = dateScheduleDateBlockTimingFilter({ timing: weekTiming, schedule });

it('should only allow the specified days of the week', () => {
Expand Down

0 comments on commit 7c6be73

Please sign in to comment.