Merge branch 'expectAllTruthyAndFalsy' of https://github.com/yasinkocak/jasmine into main

* Merges #1875 from @yasinkocak
* Adds additional assertions to tests for toBeTruthy and toBeFalsy
This commit is contained in:
Steve Gravrock
2021-02-27 10:28:51 -08:00
2 changed files with 18 additions and 0 deletions

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);
}); });
}); });

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);
}); });