Skip to content

Commit

Permalink
test: at and between expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
orimdominic committed Jun 11, 2023
1 parent 0d5c115 commit 6fadc69
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/cron.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ describe("Standard Cron Expressions", () => {
expect(cron.atMinute(30)).toEqual("30 * * * *");
expect(cron.atMinute(45)).toEqual("45 * * * *");
});

it("gets between minutes expressions", () => {
expect(cron.betweenMinutes(0, 59)).toEqual("0-59 * * * *");
})
});

describe("Hours", () => {
Expand All @@ -60,6 +64,10 @@ describe("Standard Cron Expressions", () => {
// alternative
expect(cron.everyCustomHour(3)).toEqual("0 */3 * * *");
expect(cron.everyCustomHour(4)).toEqual("0 */4 * * *");

it("gets between hours expressions", () => {
expect(cron.betweenHours(0, 23)).toEqual("0 0-23 * * *");
})
});

describe("Days", () => {
Expand All @@ -84,8 +92,26 @@ describe("Standard Cron Expressions", () => {
it("gets every week day expressions at 00:00", () => {
expect(cron.everyWeekDay()).toEqual("0 0 * * 1-5");
});

it("gets at day expressions", () => {
expect(cron.atDay(1)).toEqual("0 0 1 * *");
})

it("gets between days expressions", () => {
expect(cron.betweenDays(0, 31)).toEqual("0 0 0-31 * *");
})
});

describe('Month', () => {
it('gets at month expressions', () => {
expect(cron.atMonth(0)).toEqual("0 0 1 0 *");
})

it('gets between months expressions', () => {
expect(cron.betweenMonths(0, 11)).toEqual("0 0 1 0-11 *");
})
})

describe("Through The Day", () => {
it("gets 12:00 AM", () => {
expect(cron.atStartOfTheDay()).toEqual("0 0 * * *");
Expand Down

0 comments on commit 6fadc69

Please sign in to comment.