Skip to content

Commit 3f5c47d

Browse files
committed
expect all truthy and falsy
1 parent 1320b06 commit 3f5c47d

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

spec/core/matchers/toBeFalsySpec.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ describe('toBeFalsy', function() {
1515
result = matcher.compare(null);
1616
expect(result.pass).toBe(true);
1717

18+
result = matcher.compare(undefined);
19+
expect(result.pass).toBe(true);
20+
1821
result = matcher.compare(void 0);
1922
expect(result.pass).toBe(true);
2023
});
@@ -34,5 +37,11 @@ describe('toBeFalsy', function() {
3437

3538
result = matcher.compare({});
3639
expect(result.pass).toBe(false);
40+
41+
result = matcher.compare([]);
42+
expect(result.pass).toBe(false);
43+
44+
result = matcher.compare(function() {});
45+
expect(result.pass).toBe(false);
3746
});
3847
});

spec/core/matchers/toBeTruthySpec.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ describe('toBeTruthy', function() {
1414

1515
result = matcher.compare({});
1616
expect(result.pass).toBe(true);
17+
18+
result = matcher.compare([]);
19+
expect(result.pass).toBe(true);
20+
21+
result = matcher.compare(function() {});
22+
expect(result.pass).toBe(true);
1723
});
1824

1925
it("fails for 'falsy' values", function() {
@@ -32,6 +38,9 @@ describe('toBeTruthy', function() {
3238
result = matcher.compare(null);
3339
expect(result.pass).toBe(false);
3440

41+
result = matcher.compare(undefined);
42+
expect(result.pass).toBe(false);
43+
3544
result = matcher.compare(void 0);
3645
expect(result.pass).toBe(false);
3746
});

0 commit comments

Comments
 (0)