Equality Operations
Test for value equality with these assertions.
equal / equals
Asserts that the target is strictly (==) equal to the given value.
expect("hello").to.equal("hello");expect(42).to.equal(42);expect(42).to.equals(42); // aliasWith Negation
expect("hello").to.not.equal("world");Comparing with null
A null reference is equal to null; an empty (but non-null) value is not.
string s = null;expect(s).to.equal(null);expect("").to.not.equal(null);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.