-
Notifications
You must be signed in to change notification settings - Fork 16
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
Support reference comparison #210
Comments
Hey @jakubzitny! Thanks for your feedback 🙏 I am totally open to a PR (I promise I will review it faster than I replied to your issue 😅). I prefer the option that maintains parity with the core of Wanna help? :) |
Actually, thinking more about this, I think At the end of the day, assuming |
Our use case is covering shallow compare compatibility of our state. We have a store which returns a |
Thanks for the answers. Well, the use case is simple — I wanna be sure that a method (from flux store, a custom collection, or any class that stores Immutable data internally and returns them filtered/modified/mapped) returns always the same "modified" collection and does not re-create it on call every time (unless the data has changed). Or as @jankuca mentioned above. I think changing the |
Gotcha, thanks for the clarification! Agreed, let's go with Thank you both for your help, looking forward to a PR! :) |
Hey @jakubzitny and @jankuca, quick follow-up: do you still intend to open a PR for this? I'd be happy to include it in the next release :) |
Sure -> #218 😉 |
This has now be released as part of v2.1.0. Thanks again! |
Right now, the
.to.equal
assertion after havingchai-immutable
inchai
does "deep" comparison. It compares the keys and values of Maps, values of Lists and so on. This breaks the original behaviour of.to.equal
inchai
.I understand that it is done on purpose, and test code often needs this more than reference comparison. However, when having
chai-immutable
in our specs, we can't compare references, only viaexpect(a === b).to.be.true
which is not a good practice in "having readable assertions". There is even an eslint plugin for it.It would be cool to:
chai-immutable
'sequal
toeql
ordeep.equal
and keepequal
for comparing references (this will break backward compatibility here, but will unify the behaviour with the rest ofchai
).to.referenceEqual
Would you be open to a PR for any of these? Or is there any other problem or issue regarding this?
The text was updated successfully, but these errors were encountered: