Skip to content

Commit

Permalink
fix: update least-operability when making key-pair fully operable
Browse files Browse the repository at this point in the history
  • Loading branch information
seanstrom committed Jun 11, 2024
1 parent e7bc815 commit 8d0ba95
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/status_im/contexts/settings/wallet/data_store.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
8 changes: 5 additions & 3 deletions src/status_im/contexts/settings/wallet/events_test.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 [] {})}
Expand Down

0 comments on commit 8d0ba95

Please sign in to comment.