Skip to content

Commit b12bdb3

Browse files
committed
update manual assertions comments for chapter 3
1 parent 015fb0f commit b12bdb3

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

chapter3/2_writing_good_assertions/4_manual_assertions/inventoryController.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ const getInventory = () => {
1414
return { ...contents, [name]: quantity };
1515
}, {});
1616

17+
// To make the tests in this folder pass, update this
18+
// line so that it doesn't set the new Date's year to 3000.
1719
return { ...contents, generatedAt: new Date(new Date().setYear(3000)) };
1820
};
1921

chapter3/2_writing_good_assertions/4_manual_assertions/inventoryController.test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
const { getInventory } = require("./inventoryController");
22

3+
// This test _will_ fail.
4+
// Here I'm trying to demonstrate Jest's output
5+
// when an assertion like `.toBe(true)` fails.
36
test("generatedAt in the past", () => {
47
const result = getInventory();
58
const currentTime = Date.now() + 1;

chapter3/2_writing_good_assertions/4_manual_assertions/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)