New feature idea: elementsEqualIgnoringOrder #898
amomchilov
started this conversation in
Ideas
Replies: 1 comment
-
That would be a really handy matcher, or even a set of matchers like in jest-extended: https://github.com/jest-community/jest-extended#toincludeallmembersmembers |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is it a good idea to implement an order-agnostic variant of the
elementsEqual
matcher? I don't mind implementing it, I just don't know if I'm testing "the right way".For context, I'm testing an algorithm that produces an array whose elements are unordered. Under the hood, they're the result of flattening/filtering/processing a dictionary. I want to assert that say,
1
,2
,3
are present (and nothing else), ignoring the order they appear in.My real elements aren't really sortable, so I can't just sort the expected result and actual result, and compare them that way.
I wouldn't mind implementing this and contributing it. Should I?
Beta Was this translation helpful? Give feedback.
All reactions