Pattern: Use of restricted matcher
Issue: -
Some Jest matchers may be restricted to enforce better testing practices or maintain consistency across test suites. Alternative matchers may be suggested based on project requirements.
Example of incorrect code:
expect(value).toBeFalsy();
await expect(promise).resolves.toBe(true);
expect(mock).not.toHaveBeenCalledWith("param");
Example of correct code:
expect(value).toBe(false);
await expect(promise).rejects.toThrow();
expect(mock).toHaveBeenCalledWith("expectedParam");