-
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
Communities: Share airdrop address #18505
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
(ns status-im.contexts.communities.actions.airdrop-addresses.style) | ||
|
||
(def account-list-container | ||
{:flex 1 | ||
:padding-top 12 | ||
:padding-bottom 8}) | ||
{:padding-horizontal 8 | ||
:padding-bottom 8}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -459,3 +459,25 @@ | |
(let [{:keys [formatted-balance tokens]} (rf/sub [sub-name])] | ||
(is (match? 2 (count tokens))) | ||
(is (match? "$4506.00" formatted-balance))))) | ||
|
||
(h/deftest-sub :wallet/accounts-with-customization-color | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ajayesivan, I think it's kind of hard to understand what's being tested due to the amount of setup data. The subscription only does one While reviewing this test I just noticed (h/deftest-sub :wallet/accounts-with-customization-color
[sub-name]
(testing "returns all accounts with `customization-color` copied from `color`"
(swap! rf-db/app-db
(fn [db]
(-> db
(assoc-in [:wallet :accounts] accounts)
(assoc-in [:wallet :networks] network-data))))
(is (= [(-> accounts
(get "0x1")
(assoc :customization-color :blue)
(assoc :network-preferences-names #{:ethereum :arbitrum :optimism}))
(-> accounts
(get "0x2")
(assoc :customization-color :purple)
(assoc :network-preferences-names #{:ethereum :arbitrum :optimism}))
(-> accounts
(get "0x3")
(assoc :customization-color :magenta)
(assoc :network-preferences-names #{}))]
(rf/sub [sub-name]))))) |
||
[sub-name] | ||
(testing "returns all accounts with customization color" | ||
(swap! rf-db/app-db | ||
#(-> % | ||
(assoc-in [:wallet :accounts] accounts) | ||
(assoc-in [:wallet :networks] network-data))) | ||
(is | ||
(= [(-> accounts | ||
(get "0x1") | ||
(assoc :customization-color :blue) | ||
(assoc :network-preferences-names #{:ethereum :arbitrum :optimism})) | ||
(-> accounts | ||
(get "0x2") | ||
(assoc :customization-color :purple) | ||
(assoc :network-preferences-names #{:ethereum :arbitrum :optimism})) | ||
(-> accounts | ||
(get "0x3") | ||
(assoc :customization-color :magenta) | ||
(assoc :network-preferences-names #{}))] | ||
(rf/sub [sub-name]))))) |
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.
We want to write tests for layer-3 subs @ajayesivan. Layer-3 subs are the ones that do more than just extract data (often extractors just use
get
orget-in
). Guideline https://github.com/status-im/status-mobile/blob/a2bf23cc1281fa10a5b44e65c4cf41c2efeda293/doc/new-guidelines.md#subscription-testsBy using
deftest-sub
we also make sure changes in subscriptions are interconnected. For example, introducing breaking changes in any sub that's a dependency of another sub should theoretically break both of their subscription tests. That's why it's so important to test all layer-3 subs.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.
Hi @ilmotta, Thanks for the review and suggestion. I have added tests, could you please have a look?
Thank you!