-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow toBeCloseTo to accept an array #4116
Comments
I don't think there is any benefit over calling the matcher individually on each item. If that's not sufficient, there is |
See #4058 |
I know this is closed, and I'll write my own, but it would be really nice if |
For anyone coming in via a search, there is now https://www.npmjs.com/package/jest-matcher-deep-close-to @cpojer the download count on that project disagrees |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Do you want to request a feature or report a bug?
Feature
What is the current behavior?
The
toBeCloseTo()
matcher accepts only scalar numbers. Passing an array automatically fails the test.What is the expected behavior?
For it to work when passing an array, to check that all items of
received
are close toexpected
.Example:
I think this is different from #3654 and #4057 in that it's simply extending this existing matcher in an intuitive manner, and isn't limited to extremely specific use cases.
Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
Jest 20.0.4 with essentially the default Create React App configuration.
The text was updated successfully, but these errors were encountered: