Pattern: Equality comparison as boolean
Issue: -
Using boolean assertions for equality comparisons is less readable than Jest's built-in equality matchers. The matchers provide clearer error messages when tests fail.
Example of incorrect code:
expect(x === 5).toBe(true);
expect(name === "Carl").not.toEqual(true);
expect(obj !== otherObj).toStrictEqual(true);
Example of correct code:
expect(x).toBe(5);
expect(name).not.toEqual("Carl");
expect(obj).not.toStrictEqual(otherObj);