Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sandypockets committed Mar 26, 2024
1 parent 6ecc6e1 commit 7502d58
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"bugs": {
"url": "https://github.com/sandypockets/easy-dates/issues"
},
"version": "0.27.1",
"version": "0.27.2",
"main": "dist/index.js",
"module": "dist/index.mjs",
"license": "MIT",
Expand Down
11 changes: 7 additions & 4 deletions src/daysFromNow/daysFromNow.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ test("one day from now to be tomorrow", () => {
expect(daysFromNow(1, "en-CA")).toBe(asDate);
});

test("seven days from now to be a week", () => {
const currentDate = new Date(Date.now()).getTime();
const asDate = new Date(currentDate + oneDay * 7).toLocaleString("en-CA");
expect(daysFromNow(7, "en-CA")).toBe(asDate);
test("seven days from now should be a week from today", () => {
const multiplier = 7;
const today = new Date();
const expectedDate = new Date(today.setDate(today.getDate() + multiplier));
const resultDate = new Date(daysFromNow(multiplier)).toDateString();
const expectedDateString = expectedDate.toDateString();
expect(resultDate).toBe(expectedDateString);
});

test("it can accept a string", () => {
Expand Down

0 comments on commit 7502d58

Please sign in to comment.