Skip to content

Commit

Permalink
clean code after recovered account fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
FFFra committed Mar 19, 2024
1 parent 187d935 commit 7da7788
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 45 deletions.
15 changes: 15 additions & 0 deletions src/tests/contract_test/wallet_recovered_account_test.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,18 @@
main-account
derivation-path)]
(assert-derived-account response)))))

(defn assert-wallet-tokens
[tokens]
(let [flattened-tokens (mapcat val tokens)]
(is (some :symbol flattened-tokens))))

(deftest wallet-get-walet-token-test
(h/test-async :wallet/get-wallet-token
(fn []
(p/let [accounts (contract-utils/call-rpc "accounts_getAccounts")
main-account (get-main-account accounts)
response (contract-utils/call-rpc
"wallet_getWalletToken"
[main-account])]
(assert-wallet-tokens response)))))
45 changes: 0 additions & 45 deletions src/tests/contract_test/wallet_test.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -65,48 +65,3 @@
(fn []
(p/let [response (contract-utils/call-rpc "wallet_getEthereumChains")]
(assert-ethereum-chains response)))))

(defn get-main-account
[accounts]
(:address (first accounts)))

(def test-password integration-constants/password)

(defn assert-derived-account
[response]
(is (= (:address response) (:address response)))
(is (= (:public-key response) (:public-key response)))
(is (= "m/43'/60'/1581'/0'/0" (:path (first response)))))

(deftest wallet-get-derived-addressess-contract-test
(h/test-async :wallet/create-derived-addresses
(fn []
(p/let [_ (h/enable-testnet!)
_ (h/recover-multiaccount!)
sha3-pwd (native-module/sha3 test-password)
derivation-path ["m/43'/60'/1581'/0'/0"]
accounts (contract-utils/call-rpc "accounts_getAccounts")
main-account (get-main-account accounts)
response (contract-utils/call-rpc
"wallet_getDerivedAddresses"
sha3-pwd
main-account
derivation-path)]
(assert-derived-account response)))))

(defn assert-wallet-tokens
[tokens]
(let [flattened-tokens (mapcat val tokens)]
(is (some :symbol flattened-tokens))))

(deftest wallet-get-walet-token-test
(h/test-async :wallet/get-wallet-token
(fn []
(p/let [_ (h/enable-testnet!)
_ (h/recover-multiaccount!)
accounts (contract-utils/call-rpc "accounts_getAccounts")
main-account (get-main-account accounts)
response (contract-utils/call-rpc
"wallet_getWalletToken"
[main-account])]
(assert-wallet-tokens response)))))

0 comments on commit 7da7788

Please sign in to comment.