This repository was archived by the owner on Sep 14, 2024. It is now read-only.
This repository was archived by the owner on Sep 14, 2024. It is now read-only.
Lack of easy way to assert that a value is true or false or truthy or falsy #45
Open
Description
The current way to check if a value is true is to use something like
expect(value).to.equal(true)
and to check if a value is false
expect(value).to.equal(false)
which is somewhat clunky, and can even lead to bugs, as it is tempting to write something like
expect(value).to.be.ok()
when value is a boolean which we expect to be either true or false, and we want the test to fail when value is false. Furthermore, the source code for ok()
even states that ok()
asserts that the value is truthy, when it really only checks that it is not nil.
The existence of functions like truthy()
and falsy()
could help to solve these problems.