Skip to content

Equality Operations

Test for value equality with these assertions.

equal

Asserts that the target is strictly (==) equal to the given value.

expect("hello").to.equal("hello");
expect(42).to.equal(42);

With Negation

expect("hello").to.not.equal("world");

approximately

Asserts that a numeric value is within a tolerance of the expected value.

expect(3.14159).to.be.approximately(3.14, 0.01);

Useful for floating-point comparisons where exact equality isn’t possible.