Skip to content

Commit

Permalink
try to fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
briansztamfater committed Apr 25, 2024
1 parent c36d913 commit bc22785
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions src/status_im/contexts/wallet/send/utils_test.cljs
Expand Up @@ -265,25 +265,26 @@

(deftest test-network-amounts
(testing "Handles disabled and receiver networks correctly when to? is true"
(let [network-values {"1" {:chain-id "1" :amount (money/bignumber "100")}
"10" {:chain-id "10" :amount (money/bignumber "200")}}
(let [network-values {"1" (money/bignumber "100")
"10" (money/bignumber "200")}
disabled-chain-ids ["1"]
receiver-networks ["10"]
to? true
expected [{:chain-id "1"
:total-amount (money/bignumber "0")
:type :default}
{:chain-id "10"
expected [{:chain-id "10"
:total-amount (money/bignumber "200")
:type :default}]
:type :default}
{:chain-id "1"
:total-amount (money/bignumber "100")
:type :default}
{:type :add}]
result (utils/network-amounts network-values
disabled-chain-ids
receiver-networks
to?)]
(is (every? identity (map #(map/deep-compare %1 %2) expected result)))))

(testing "Adds default amount for non-disabled non-receiver networks when to? is false"
(let [network-values {"1" {:chain-id "1" :amount (money/bignumber "100")}}
(let [network-values {"1" (money/bignumber "100")}
disabled-chain-ids ["10"]
receiver-networks []
to? false
Expand Down Expand Up @@ -312,14 +313,20 @@
(is (= expected result))))

(testing "Processes case with multiple network interactions"
(let [network-values {"1" {:chain-id "1" :amount (money/bignumber "300")}
"10" {:chain-id "10" :amount (money/bignumber "400")}
"42161" {:chain-id "42161" :amount (money/bignumber "500")}}
(let [network-values {"1" (money/bignumber "300")
"10" (money/bignumber "400")
"42161" (money/bignumber "500")}
disabled-chain-ids ["1" "42161"]
receiver-networks ["10"]
to? true
expected [{:chain-id "10"
expected [{:chain-id "1"
:total-amount (money/bignumber "300")
:type :default}
{:chain-id "10"
:total-amount (money/bignumber "400")
:type :default}
{:chain-id "42161"
:total-amount (money/bignumber "500")
:type :default}]
result (utils/network-amounts network-values
disabled-chain-ids
Expand Down

0 comments on commit bc22785

Please sign in to comment.