Skip to content
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
@christopherhafke

Description

@christopherhafke

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions