expect all truthy and falsy

This commit is contained in:
Yasin Kocak
2021-01-02 10:55:14 +01:00
parent 1320b0614f
commit 3f5c47dff3
2 changed files with 18 additions and 0 deletions
+9
View File
@@ -15,6 +15,9 @@ describe('toBeFalsy', function() {
result = matcher.compare(null); result = matcher.compare(null);
expect(result.pass).toBe(true); expect(result.pass).toBe(true);
result = matcher.compare(undefined);
expect(result.pass).toBe(true);
result = matcher.compare(void 0); result = matcher.compare(void 0);
expect(result.pass).toBe(true); expect(result.pass).toBe(true);
}); });
@@ -34,5 +37,11 @@ describe('toBeFalsy', function() {
result = matcher.compare({}); result = matcher.compare({});
expect(result.pass).toBe(false); expect(result.pass).toBe(false);
result = matcher.compare([]);
expect(result.pass).toBe(false);
result = matcher.compare(function() {});
expect(result.pass).toBe(false);
}); });
}); });
+9
View File
@@ -14,6 +14,12 @@ describe('toBeTruthy', function() {
result = matcher.compare({}); result = matcher.compare({});
expect(result.pass).toBe(true); expect(result.pass).toBe(true);
result = matcher.compare([]);
expect(result.pass).toBe(true);
result = matcher.compare(function() {});
expect(result.pass).toBe(true);
}); });
it("fails for 'falsy' values", function() { it("fails for 'falsy' values", function() {
@@ -32,6 +38,9 @@ describe('toBeTruthy', function() {
result = matcher.compare(null); result = matcher.compare(null);
expect(result.pass).toBe(false); expect(result.pass).toBe(false);
result = matcher.compare(undefined);
expect(result.pass).toBe(false);
result = matcher.compare(void 0); result = matcher.compare(void 0);
expect(result.pass).toBe(false); expect(result.pass).toBe(false);
}); });