Skip to content

Commit 13ac2b7

Browse files
committed
Re-add koans/AboutAsserts.js - thanks hakanson!
1 parent 9511e0b commit 13ac2b7

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

koans/AboutExpects.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
describe("About Expects", function() {
2+
3+
//We shall contemplate truth by testing reality, via spec expectations.
4+
it("should expect true", function() {
5+
expect(false).toBeTruthy(); //This should be true
6+
});
7+
8+
//To understand reality, we must compare our expectations against reality.
9+
it("should expect equality", function () {
10+
var expectedValue = __;
11+
var actualValue = 1 + 1;
12+
13+
expect(expectedValue === actualValue).toBeTruthy();
14+
});
15+
16+
//Some ways of asserting equality are better than others.
17+
it("should assert equality a better way", function () {
18+
var expectedValue = __;
19+
var actualValue = 1 + 1;
20+
21+
// toEqual() compares using common sense equality
22+
expect(actualValue).toEqual(expectedValue);
23+
});
24+
25+
//Sometime you need to be really exact
26+
it("should assert equality with ===", function () {
27+
var expectedValue = __;
28+
var actualValue = 1 + 1;
29+
30+
// toBe() will always use === to compare
31+
expect(actualValue).toBe(expectedValue);
32+
});
33+
34+
//Sometimes we will ask you to fill in the values
35+
it("should have filled in values", function () {
36+
expect(__).toEqual(1 + 1);
37+
});
38+
});

0 commit comments

Comments
 (0)