Skip to content

Commit d3857dc

Browse files
committed
component tests fixes
1 parent 07101e2 commit d3857dc

File tree

4 files changed

+31
-22
lines changed

4 files changed

+31
-22
lines changed

src/quo/components/wallet/token_input/component_spec.cljs

+12-8
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,20 @@
66
(h/describe "Wallet: Token Input"
77
(h/test "Token label renders"
88
(h/render-with-theme-provider [token-input/view
9-
{:token :snt
10-
:currency :eur
11-
:crypto? true
12-
:conversion 1}])
9+
{:token-symbol :snt
10+
:currency-symbol :snt
11+
:on-swap nil
12+
:error? false
13+
:value "1"
14+
:converted-value "10"}])
1315
(h/is-truthy (h/get-by-text "SNT")))
1416

1517
(h/test "Amount renders"
1618
(h/render-with-theme-provider [token-input/view
17-
{:token :snt
18-
:currency :eur
19-
:converted-value "€0.00"
20-
:conversion 1}])
19+
{:token-symbol :snt
20+
:currency-symbol :snt
21+
:on-swap nil
22+
:error? false
23+
:value "1"
24+
:converted-value "€0.00"}])
2125
(h/is-truthy (h/get-by-text "€0.00"))))

src/status_im/contexts/preview/quo/wallet/token_input.cljs

+7-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,13 @@
4343
input-amount (controlled-input/input-value input-state)
4444
swap-between-fiat-and-crypto (fn []
4545
(if crypto?
46-
(set-input-state #(controlled-input/->fiat % conversion-rate))
47-
(set-input-state #(controlled-input/->crypto % conversion-rate))))
46+
(set-input-state #(controlled-input/->fiat
47+
%
48+
conversion-rate))
49+
(set-input-state
50+
#(controlled-input/->crypto
51+
%
52+
conversion-rate))))
4853
converted-value (if crypto?
4954
(utils/prettify-balance currency
5055
(money/crypto->fiat

src/status_im/contexts/wallet/send/input_amount/component_spec.cljs

+11-11
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
(h/setup-subs sub-mocks)
111111
(h/render-with-theme-provider [input-amount/view
112112
{:crypto-decimals 2
113-
:limit-crypto 250
113+
:limit-crypto (money/bignumber 250)
114114
:initial-crypto-currency? false}])
115115
(h/is-truthy (h/get-by-text "0"))
116116
(h/is-truthy (h/get-by-text "USD"))
@@ -124,7 +124,7 @@
124124
(let [on-confirm (h/mock-fn)]
125125
(h/render-with-theme-provider [input-amount/view
126126
{:crypto-decimals 10
127-
:limit-crypto 1000
127+
:limit-crypto (money/bignumber 1000)
128128
:on-confirm on-confirm
129129
:initial-crypto-currency? true}])
130130

@@ -135,18 +135,19 @@
135135
(h/fire-event :press (h/query-by-label-text :keyboard-key-4))
136136
(h/fire-event :press (h/query-by-label-text :keyboard-key-5))
137137

138+
138139
(-> (h/wait-for #(h/get-by-text "$1234.50"))
139140
(.then (fn []
140-
(h/is-truthy (h/get-by-label-text :button-one))
141-
(h/is-truthy (h/get-by-label-text :container))
142-
(h/fire-event :press (h/get-by-label-text :button-one))
143-
(h/was-called on-confirm))))))
141+
(let [btn (h/get-by-label-text :button-one)]
142+
(h/is-truthy btn)
143+
(h/fire-event :press btn)
144+
(h/was-called on-confirm)))))))
144145

145146
(h/test "Try to fill more than limit"
146147
(h/setup-subs sub-mocks)
147148
(h/render-with-theme-provider [input-amount/view
148149
{:crypto-decimals 1
149-
:limit-crypto 1}])
150+
:limit-crypto (money/bignumber 1)}])
150151

151152
(h/fire-event :press (h/query-by-label-text :keyboard-key-2))
152153
(h/fire-event :press (h/query-by-label-text :keyboard-key-9))
@@ -158,13 +159,12 @@
158159
(h/setup-subs sub-mocks)
159160
(h/render-with-theme-provider [input-amount/view
160161
{:crypto-decimals 1
161-
:limit-crypto 1
162+
:limit-crypto (money/bignumber 10)
162163
:on-confirm #()}])
163164

165+
(h/fire-event :press (h/query-by-label-text :keyboard-key-9))
164166
(h/fire-event :press (h/query-by-label-text :keyboard-key-9))
165167
(h/is-truthy (h/get-by-label-text :container-error))
166168
(h/fire-event :press (h/query-by-label-text :reorder))
169+
(h/is-truthy #(h/get-by-text "Max: $100.00"))))
167170

168-
(-> (h/wait-for #(h/get-by-text "Max: $1000.00"))
169-
(.then (fn []
170-
(h/wait-for #(h/is-truthy (h/get-by-label-text :container))))))))

src/status_im/contexts/wallet/send/input_amount/view.cljs

+1-1
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@
335335
:t/send-limit
336336
{:limit (if crypto-currency?
337337
(utils/prettify-crypto-balance
338-
token-symbol
338+
(or (clj->js token-symbol) "")
339339
(controlled-input/upper-limit input-state)
340340
conversion-rate)
341341
(utils/prettify-balance currency-symbol

0 commit comments

Comments
 (0)