From 8d0ba9503f498a0f8e6a44fb610dff46c343b7c0 Mon Sep 17 00:00:00 2001 From: Sean Hagstrom Date: Tue, 11 Jun 2024 11:45:57 +0100 Subject: [PATCH] fix: update least-operability when making key-pair fully operable --- src/status_im/contexts/settings/wallet/data_store.cljs | 6 +++--- src/status_im/contexts/settings/wallet/events_test.cljs | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/status_im/contexts/settings/wallet/data_store.cljs b/src/status_im/contexts/settings/wallet/data_store.cljs index f24a3cdc975..a9c9b47abae 100644 --- a/src/status_im/contexts/settings/wallet/data_store.cljs +++ b/src/status_im/contexts/settings/wallet/data_store.cljs @@ -40,8 +40,8 @@ [keypairs key-uids-set] (map (fn [keypair] (if (contains? key-uids-set (:key-uid keypair)) - (update keypair - :accounts - make-keypairs-accounts-fully-operable) + (-> keypair + (update :accounts make-keypairs-accounts-fully-operable) + (assoc :lowest-operability :fully)) keypair)) keypairs)) diff --git a/src/status_im/contexts/settings/wallet/events_test.cljs b/src/status_im/contexts/settings/wallet/events_test.cljs index dafced1e67e..f1690b25bce 100644 --- a/src/status_im/contexts/settings/wallet/events_test.cljs +++ b/src/status_im/contexts/settings/wallet/events_test.cljs @@ -57,8 +57,9 @@ (sut/remove-keypair cofx [mock-key-uid]))))))) (deftest make-keypairs-accounts-fully-operable-test - (let [db (mock-db [{:key-uid mock-key-uid - :accounts [{:key-uid mock-key-uid :operable "no"}]}] + (let [db (mock-db [{:key-uid mock-key-uid + :lowest-operability :no + :accounts [{:key-uid mock-key-uid :operable "no"}]}] {"0x1" {:key-uid mock-key-uid :operable "no"}}) key-uids-to-update [mock-key-uid]] (testing "make-keypairs-accounts-fully-operable" @@ -68,7 +69,8 @@ (get-in result-db [:wallet :keypairs])) updated-account (get-in result-db [:wallet :accounts "0x1"])] (is (= (keyword (-> updated-keypair :accounts first :operable)) :fully)) - (is (= (keyword (:operable updated-account)) :fully)))))) + (is (= (keyword (:operable updated-account)) :fully)) + (is (= (:lowest-operability updated-keypair) :fully)))))) (deftest connection-string-for-import-keypair-test (let [cofx {:db (mock-db [] {})}