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

add integration test for send #18910

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix: only run unit tests in test-unit target
  • Loading branch information
ilmotta authored and J-Son89 committed Feb 26, 2024
commit f31246bed503b1ba2a8cc6494281aab8ff9b7a6a
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ test-watch-for-repl: ##@test Watch all Clojure tests and support REPL connection
"until [ -f $$SHADOW_OUTPUT_TO ] ; do sleep 1 ; done ; node --require ./test-resources/override.js $$SHADOW_OUTPUT_TO --repl"

test-unit: export SHADOW_OUTPUT_TO := target/unit_test/test.js
test-unit: export SHADOW_NS_REGEXP := ^(?!tests\.integration-test)(?!tests-im\.contract-test).*-test$$
test-unit: export SHADOW_NS_REGEXP := ^(?!tests\.integration-test)(?!tests\.contract-test).*-test$$
Copy link
Contributor Author

Choose a reason for hiding this comment

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

copied from @ilmotta's pr

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry it took me a while to merge because I thought I had it in. You should be able to rebase with the fix now.

test-unit: ##@test Run unit tests
test-unit: _test-clojure

Expand Down
2 changes: 1 addition & 1 deletion src/test_helpers/integration.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
(defmacro with-app-initialized
[& body]
`(do
(tests.test/init!)
(tests.test-utils/init!)
(if (test-helpers.integration/app-initialized)
(do ~@body)
(do
Expand Down
1 change: 0 additions & 1 deletion src/test_helpers/integration.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
[]
(is (= @(rf/subscribe [:communities/create]) constants/community)))


(defn logout
[]
(rf/dispatch [:logout]))
Expand Down
1 change: 0 additions & 1 deletion src/tests/integration_test/constants.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

(def account-name "account-abc")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

el


(def recovery-account
{:name "wallet-abc"
:seed-phrase "destroy end torch puzzle develop note wise island disease chaos kind bus"
Expand Down
5 changes: 3 additions & 2 deletions src/tests/integration_test/wallet_test.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
[accounts]
(first (filter :wallet accounts)))

(def send-amount "0.00001")
(def send-amount "0.0001")

(deftest wallet-send-test
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is one of the main focuses of this pr. 🦅

Copy link
Contributor

Choose a reason for hiding this comment

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

It seems good @J-Son89

I'd like to have a clearer way to read it, but it seems the re-frame's macro wait-for is making the reading harder.

Looking at the implementation of that macro, it returns:

 ;; ...
(wait-for* ~ids ~failure-ids (fn [~event-sym] ~@body))

and wait-for* is a function, we could probably use it in our own macro for testing.

@ilmotta wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah the wait for makes it ugly to write too.

one other feature that would be nice, often we want to wait on multiple keys and in order, but we don't support this.

we can only wait for multiple but once one is satisfied then it moves forward

(h/log-headline :wallet-send-test)
Expand All @@ -38,13 +38,14 @@
:receipient address
:stack-id :wallet-select-address}])
(let [filtered-tokens (rf/sub [:wallet/tokens-filtered "eth"])]

(rf/dispatch [:wallet/send-select-token
{:token (first filtered-tokens)
:stack-id :wallet-select-asset}])
(rf-test/wait-for
[:wallet/clean-suggested-routes]
(rf/dispatch
[:wallet/get-suggested-routes send-amount]))
[:wallet/get-suggested-routes {:amount send-amount}]))
(rf-test/wait-for
[:wallet/suggested-routes-success]
(let [route (rf/sub [:wallet/wallet-send-route])]
Expand Down