Skip to content
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

Wallet: Utility Tests #18371

Merged
merged 24 commits into from
Jan 5, 2024
Merged

Wallet: Utility Tests #18371

merged 24 commits into from
Jan 5, 2024

Conversation

OmarBasem
Copy link
Contributor

fixes: #18370

This PR adds tests for all utility functions under status-im.contexts.wallet.common.utils

@status-im-auto
Copy link
Member

status-im-auto commented Jan 3, 2024

Jenkins Builds

Click to see older builds (49)
Commit #️⃣ Finished (UTC) Duration Platform Result
f85630d #1 2024-01-03 12:40:17 ~2 min tests 📄log
✔️ f85630d #1 2024-01-03 12:43:14 ~5 min ios 📱ipa 📲
✔️ f85630d #1 2024-01-03 12:45:32 ~7 min android-e2e 🤖apk 📲
✔️ f85630d #1 2024-01-03 12:46:45 ~9 min android 🤖apk 📲
fad78ca #2 2024-01-04 12:23:11 ~2 min tests 📄log
✔️ fad78ca #2 2024-01-04 12:28:18 ~7 min ios 📱ipa 📲
✔️ fad78ca #2 2024-01-04 12:28:36 ~7 min android-e2e 🤖apk 📲
✔️ fad78ca #2 2024-01-04 12:29:04 ~8 min android 🤖apk 📲
cf4ff7b #3 2024-01-04 13:04:00 ~2 min tests 📄log
066fe22 #4 2024-01-04 13:08:18 ~2 min tests 📄log
✔️ 066fe22 #4 2024-01-04 13:11:45 ~5 min ios 📱ipa 📲
96675b2 #5 2024-01-04 13:15:16 ~2 min tests 📄log
9fdbf54 #6 2024-01-04 13:20:43 ~2 min tests 📄log
3106960 #7 2024-01-04 13:27:24 ~2 min tests 📄log
✔️ 3106960 #7 2024-01-04 13:31:16 ~6 min ios 📱ipa 📲
ea8fc97 #8 2024-01-04 13:32:47 ~1 min tests 📄log
ed8e808 #9 2024-01-04 13:37:47 ~2 min tests 📄log
d5d4cd1 #10 2024-01-04 13:41:10 ~1 min tests 📄log
✔️ d5d4cd1 #10 2024-01-04 13:45:12 ~5 min ios 📱ipa 📲
✔️ d5d4cd1 #10 2024-01-04 13:46:45 ~7 min android-e2e 🤖apk 📲
✔️ d5d4cd1 #10 2024-01-04 13:46:51 ~7 min android 🤖apk 📲
2253399 #11 2024-01-04 13:54:46 ~2 min tests 📄log
✔️ 2253399 #11 2024-01-04 13:59:27 ~6 min ios 📱ipa 📲
✔️ 2253399 #11 2024-01-04 13:59:56 ~7 min android-e2e 🤖apk 📲
✔️ 2253399 #11 2024-01-04 14:00:17 ~7 min android 🤖apk 📲
7966f9f #12 2024-01-04 14:18:30 ~1 min tests 📄log
✔️ 7966f9f #12 2024-01-04 14:22:24 ~5 min ios 📱ipa 📲
✔️ 7966f9f #12 2024-01-04 14:23:20 ~6 min android-e2e 🤖apk 📲
✔️ 7966f9f #12 2024-01-04 14:23:22 ~6 min android 🤖apk 📲
e6b34af #13 2024-01-05 04:00:33 ~2 min tests 📄log
✔️ e6b34af #13 2024-01-05 04:03:58 ~5 min ios 📱ipa 📲
✔️ e6b34af #13 2024-01-05 04:05:51 ~7 min android-e2e 🤖apk 📲
✔️ e6b34af #13 2024-01-05 04:05:59 ~7 min android 🤖apk 📲
6d689b4 #14 2024-01-05 04:11:38 ~1 min tests 📄log
✔️ 6d689b4 #14 2024-01-05 04:15:08 ~5 min ios 📱ipa 📲
bf6fc45 #15 2024-01-05 04:17:30 ~1 min tests 📄log
276e517 #16 2024-01-05 04:21:19 ~2 min tests 📄log
✔️ 276e517 #16 2024-01-05 04:24:57 ~5 min ios 📱ipa 📲
✔️ 276e517 #16 2024-01-05 04:25:43 ~6 min android-e2e 🤖apk 📲
✔️ 276e517 #16 2024-01-05 04:26:03 ~6 min android 🤖apk 📲
337a915 #17 2024-01-05 04:31:54 ~2 min tests 📄log
✔️ 337a915 #17 2024-01-05 04:35:13 ~5 min ios 📱ipa 📲
✔️ 337a915 #17 2024-01-05 04:37:19 ~7 min android-e2e 🤖apk 📲
✔️ 337a915 #17 2024-01-05 04:37:29 ~7 min android 🤖apk 📲
b7e0d6a #18 2024-01-05 11:44:19 ~2 min tests 📄log
1b965f6 #19 2024-01-05 11:48:51 ~2 min tests 📄log
8f6d2df #20 2024-01-05 11:52:39 ~2 min tests 📄log
b585d17 #21 2024-01-05 11:56:52 ~2 min tests 📄log
d7cd995 #22 2024-01-05 12:01:11 ~2 min tests 📄log
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 0bed5ed #23 2024-01-05 12:09:10 ~4 min tests 📄log
✔️ 0bed5ed #23 2024-01-05 12:10:52 ~5 min ios 📱ipa 📲
✔️ 0bed5ed #23 2024-01-05 12:13:21 ~8 min android-e2e 🤖apk 📲
✔️ 0bed5ed #23 2024-01-05 12:13:26 ~8 min android 🤖apk 📲
✔️ 68cd4e7 #24 2024-01-05 12:24:20 ~4 min tests 📄log
✔️ 68cd4e7 #24 2024-01-05 12:25:35 ~5 min ios 📱ipa 📲
✔️ 68cd4e7 #24 2024-01-05 12:26:41 ~6 min android 🤖apk 📲
✔️ 68cd4e7 #24 2024-01-05 12:27:07 ~7 min android-e2e 🤖apk 📲

networks [{:chain-id :chain-1 :name "Network A"}
{:chain-id :chain-3 :name "Network C"}]]
(is (= (utils/network-list {:balances-per-chain balances-per-chain} networks)
#{:chain-1 :chain-3})))))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just curious is :chain-1 etc abitrary? this is normally the chain id? e.g :1 ?

Copy link
Contributor Author

@OmarBasem OmarBasem Jan 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@J-Son89 yes the chain id like :1. I think the values used in tests don't matter much as long as the test returns the correct value, but I can update it to :1 👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually we are transforming (or we should) to 1 instead.

it is important to keep the type because a function could break if we don't provide the proper one (such as the common exception name not supported).

Copy link
Contributor

@ulisesmac ulisesmac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR @OmarBasem !

Some of our utility functions are being used by our subscriptions, and our subs have tests, so just let's be careful about it, we don't need to double test a function, we could instead improve the existing one, although adding extra tests isn't bad.

[balances-per-chain]
(println "calling totalxxx", balances-per-chain)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leftover

@OmarBasem
Copy link
Contributor Author

OmarBasem commented Jan 5, 2024

Some of our utility functions are being used by our subscriptions, and our subs have tests

Thanks for notifying me about this. Having tests for individual utility functions is still good to have as they may be used for other functions/subs

@OmarBasem OmarBasem force-pushed the wallet/utils-test branch 2 times, most recently from b7e0d6a to 1b965f6 Compare January 5, 2024 11:46
@OmarBasem OmarBasem merged commit c6a7808 into develop Jan 5, 2024
6 checks passed
@OmarBasem OmarBasem deleted the wallet/utils-test branch January 5, 2024 12:29
yevh-berdnyk pushed a commit that referenced this pull request Jan 5, 2024
* Wallet: utility tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Archived in project
Development

Successfully merging this pull request may close these issues.

Wallet: add tests from wallet utility functions
4 participants