forked from aeharding/voyager
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Alexander Harding <[email protected]>
- Loading branch information
1 parent
9ee360a
commit 062df5f
Showing
6 changed files
with
71 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { addHours, addMinutes, subMinutes, subYears } from "date-fns"; | ||
import { calculateIsCakeDay } from "./date"; | ||
|
||
describe("cake cake", () => { | ||
it("not cake day when created", () => { | ||
expect(calculateIsCakeDay(new Date())).toBe(false); | ||
}); | ||
|
||
it("not cake day soon after created", () => { | ||
expect(calculateIsCakeDay(addHours(new Date(), 12))).toBe(false); | ||
}); | ||
|
||
it("cake day soon one year after created", () => { | ||
expect(calculateIsCakeDay(subYears(new Date(), 1))).toBe(true); | ||
}); | ||
|
||
it("cake day in a couple minutes", () => { | ||
expect(calculateIsCakeDay(addMinutes(subYears(new Date(), 1), 2))).toBe( | ||
false, | ||
); | ||
}); | ||
|
||
it("cake day started a couple minutes ago", () => { | ||
expect(calculateIsCakeDay(subMinutes(subYears(new Date(), 1), 2))).toBe( | ||
true, | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters