Fraschetti - Add wallet-search-ens-test (#19338)
Introduces comprehensive tests for the ens_addressOf endpoint
This commit is contained in:
parent
48789e8793
commit
260a741b17
|
@ -169,7 +169,7 @@
|
||||||
:password constants/password
|
:password constants/password
|
||||||
:color "blue"}]))
|
:color "blue"}]))
|
||||||
|
|
||||||
(defn- enable-testnet!
|
(defn enable-testnet!
|
||||||
[]
|
[]
|
||||||
(rf/dispatch [:profile.settings/profile-update :test-networks-enabled? true {}])
|
(rf/dispatch [:profile.settings/profile-update :test-networks-enabled? true {}])
|
||||||
(rf/dispatch [:wallet/initialize]))
|
(rf/dispatch [:wallet/initialize]))
|
||||||
|
|
|
@ -105,3 +105,28 @@
|
||||||
chain-id
|
chain-id
|
||||||
ens-address)]
|
ens-address)]
|
||||||
(assert-address-details response)))))
|
(assert-address-details response)))))
|
||||||
|
(defn assert-search-ens
|
||||||
|
[expected-result actual-result]
|
||||||
|
(is (= expected-result actual-result)))
|
||||||
|
|
||||||
|
(deftest wallet-search-ens-test
|
||||||
|
(h/test-async :wallet/search-ens
|
||||||
|
(fn []
|
||||||
|
(promesa/let [_ (h/enable-testnet!)]
|
||||||
|
(let [test-cases [{:description "Test on Ethereum mainnet"
|
||||||
|
:ens-name "test.eth"
|
||||||
|
:chain-id constants/ethereum-mainnet-chain-id
|
||||||
|
:expected-result "0xeefb13c7d42efcc655e528da6d6f7bbcf9a2251d"}
|
||||||
|
{:description "Test on Goerli testnet"
|
||||||
|
:ens-name "qoqobolo.stateofus.eth"
|
||||||
|
:chain-id constants/ethereum-goerli-chain-id
|
||||||
|
:expected-result "0xf8f4f6b5c73f4fb561eb2676326d81b7aba180b0"}
|
||||||
|
{:description "Test on Sepolia testnet"
|
||||||
|
:ens-name "code.eth"
|
||||||
|
:chain-id constants/ethereum-sepolia-chain-id
|
||||||
|
:expected-result "0x035ebd096afa6b98372494c7f08f3402324117d3"}]]
|
||||||
|
(promesa/all
|
||||||
|
(map (fn [{:keys [ens-name chain-id expected-result]}]
|
||||||
|
(promesa/let [ens-address (contract-utils/call-rpc "ens_addressOf" chain-id ens-name)]
|
||||||
|
(assert-search-ens expected-result ens-address)))
|
||||||
|
test-cases)))))))
|
||||||
|
|
Loading…
Reference in New Issue