-
Notifications
You must be signed in to change notification settings - Fork 985
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
chore(tests): New match-strict? cljs.test directive #20825
Merged
ilmotta
merged 2 commits into
develop
from
ilmotta-20590/new-matcher-for-nested-equality
Jul 25, 2024
Merged
chore(tests): New match-strict? cljs.test directive #20825
ilmotta
merged 2 commits into
develop
from
ilmotta-20590/new-matcher-for-nested-equality
Jul 25, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ilmotta
requested review from
shivekkhurana,
seanstrom,
vkjr,
yqrashawn and
mmilad75
July 19, 2024 14:53
Jenkins BuildsClick to see older builds (4)
|
mmilad75
approved these changes
Jul 19, 2024
J-Son89
approved these changes
Jul 21, 2024
ilmotta
force-pushed
the
ilmotta-20590/new-matcher-for-nested-equality
branch
from
July 24, 2024 02:09
ebb9293
to
aaa815a
Compare
86% of end-end tests have passed
Expected to fail tests (1)Click to expandClass TestWalletOneDevice:
Passed tests (6)Click to expandClass TestWalletMultipleDevice:
Class TestCommunityOneDeviceMerged:
Class TestOneToOneChatMultipleSharedDevicesNewUi:
Class TestWalletOneDevice:
|
@jakubgs, can I have your blessing in this PR? It upgrades one of the Clojure libraries. Thanks ;) |
mohsen-ghafouri
approved these changes
Jul 24, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙏
vkjr
approved these changes
Jul 24, 2024
ilmotta
force-pushed
the
ilmotta-20590/new-matcher-for-nested-equality
branch
from
July 25, 2024 01:01
aaa815a
to
e02331c
Compare
siddarthkay
approved these changes
Jul 25, 2024
ilmotta
added a commit
that referenced
this pull request
Jul 28, 2024
Equality checks in tests using = give a bad experience by default on test failures containing nested data structures. We use the cljs.test directive match? from matcher-combinators library to help compare nested structures. The problem with match? is that its default matcher for maps (embeds) can be too permissive, and this causes surprises. Here we upgrade matcher-combinators to latest, where a new matcher called nested-equals is available. This matcher won't allow extra keys in maps. This matcher eliminates the need for manually adding nested equals matchers as we have to do currently. - Upgrades matcher-combinators from 3.8.8 to 3.9.1 (latest as of 2024-07-19) What changes? When asserting in tests, we now have the option to use match-strict? or match?. Both directives are available by integrating with cljs.test. The code implementing the new match-strict? directive was 100% copied from the library matcher-combinators because we need to wrap the expected value ourselves with matcher-combinators.matchers/nested-equals. It's ugly code, but it's how we can integrate with cljs.test/assert-expr.
ilmotta
added a commit
that referenced
this pull request
Jul 30, 2024
Revisions from develop: - 59ceddb develop origin/develop fix(wallet): fix bridge transactions (#20902) - 99ccbc3 Cover wallet send events with tests Part 2 #20411 #20533 (#20721) - 8c2d539 Enabling WalletConnect feature flag (#20906) - 67c83b1 fix(wallet): remove edit routes button in bridging (#20874) - 11a84ba feat(wallet): disable complex routing (#20901) - 1f5bb57 chore(wallet): disable bridging on unsupported tokens (#20846) - 4586f80 Add toggle in advanced settings for mobile data - 55c620e fix: create password for small screen (#20645) - 525609f Wallet Activity: transactions are not sorted by time #20808 (#20862) - 9065395 chore(settings): Disable telemetry option (#20881) - d27ab75 fix_:display group message using the new ui (#20787) - c6a1db6 ci: enable split apks & build only for arm64-v8a (#20683) - 73777e0 Ensure keycard account can send transaction after upgrading from v1 to v2 #20552 (#20845) - a6d3fc3 [#20524] fix: the missed keypairs are shown in the key pair list screen (#20888) - a671c70 fix broken screen and navigation when syncing fails (#20887) - a45991b 🥅 Filter connected dapps based on testnet mode, reject proposals and requests gracefully (#20799) - 2e9fa22 feat: wallet router v2 (#20631) - 737d8c4 rename sub to fix error when requesting to join community (#20868) - 3aa7e10 Sync process is blocked on Enabled notifications screen (#20883) - c1d2d44 perf: Fix app freeze after login (#20729) - 0fed811 e2e: updated testnet switching and added one test into smoke - 53c35cb fix(wallet): Linear gradient exception on invalid colors for watched account cards (#20854) - be82365 chore(settings)_: Remove testnet toggle from legacy advanced settings (#20875) - eae8a65 feat(wallet)_: Add beta info box in activity tab (#20873) - fe54a25 fix: not clearing network & web3-wallet on logout (#20886) - 15a4219 Reject wallet-connect request by dragging the modal down (#20763) (#20836) - 2ffbdac WalletConnect show expired toast (#20857) - 402eb83 fix Issue with scrolling WalletConnect transaction on Android (#20867) - ff88049 Fix WalletConnect header alignment on Android (#20860) - cee2124 WalletConnect no internet edge-cases (#20826) - 60ad7c8 chore(tests): New match-strict? cljs.test directive (#20825) - 4989c92 fix_: Adding own address as saved addresses (#20839)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR's issue explains in detail the problem being solved. In essence, equality checks in tests using
=
give a bad experience by default on test failures containing nested data structures. We use thecljs.test
directivematch?
from matcher-combinators library to help compare nested structures. The problem withmatch?
is that its default matcher for maps (embeds
) can be too permissive, and this causes surprises.This PR upgrades
matcher-combinators
to latest, where a new matcher callednested-equals
is available. This matcher won't allow extra keys in maps. This matcher eliminates the need for manually adding nestedequals
matchers as we have to do currently.matcher-combinators
from3.8.8
to3.9.1
(latest as of 2024-07-19)What changes?
When asserting in tests, we now have the option to use
match-strict?
ormatch?
. Both directives are available by integrating withcljs.test
. The code implementing the newmatch-strict?
directive was 100% copied from the librarymatcher-combinators
because we need to wrap the expected value ourselves withmatcher-combinators.matchers/nested-equals
. It's ugly code, but it's how we can integrate withcljs.test/assert-expr
. Hopefully we write once and profit forever.Guidelines?
I think it's too early to worry about a guideline. I would personally be inclined to use
match-strict?
the majority of the time, butmatch?
has its place too.Areas that may be impacted
All safe 🦺
status: ready