From 3f5c47dff3aa1889b5b1bab10f96b96e1d41f62e Mon Sep 17 00:00:00 2001 From: Yasin Kocak Date: Sat, 2 Jan 2021 10:55:14 +0100 Subject: [PATCH] expect all truthy and falsy --- spec/core/matchers/toBeFalsySpec.js | 9 +++++++++ spec/core/matchers/toBeTruthySpec.js | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/spec/core/matchers/toBeFalsySpec.js b/spec/core/matchers/toBeFalsySpec.js index ec4a98e4..feb1d058 100644 --- a/spec/core/matchers/toBeFalsySpec.js +++ b/spec/core/matchers/toBeFalsySpec.js @@ -15,6 +15,9 @@ describe('toBeFalsy', function() { result = matcher.compare(null); expect(result.pass).toBe(true); + result = matcher.compare(undefined); + expect(result.pass).toBe(true); + result = matcher.compare(void 0); expect(result.pass).toBe(true); }); @@ -34,5 +37,11 @@ describe('toBeFalsy', function() { result = matcher.compare({}); expect(result.pass).toBe(false); + + result = matcher.compare([]); + expect(result.pass).toBe(false); + + result = matcher.compare(function() {}); + expect(result.pass).toBe(false); }); }); diff --git a/spec/core/matchers/toBeTruthySpec.js b/spec/core/matchers/toBeTruthySpec.js index f7bb258b..134210be 100644 --- a/spec/core/matchers/toBeTruthySpec.js +++ b/spec/core/matchers/toBeTruthySpec.js @@ -14,6 +14,12 @@ describe('toBeTruthy', function() { result = matcher.compare({}); 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() { @@ -32,6 +38,9 @@ describe('toBeTruthy', function() { result = matcher.compare(null); expect(result.pass).toBe(false); + result = matcher.compare(undefined); + expect(result.pass).toBe(false); + result = matcher.compare(void 0); expect(result.pass).toBe(false); });