-
Notifications
You must be signed in to change notification settings - Fork 987
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Contacts are now in status-go, no migration of contacts is provided so all contacts will be lost upon installing this build. I have left the initialization of filters a bit sketchy (we wait that load-filters is called twice), as the next step will be to avoid calling load-filters altogether, as now that both contacts & chats are in status-go, there's no reason to call it from status-react, and can be called directly from status-go on loading.
- Loading branch information
Showing
13 changed files
with
290 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
(ns status-im.test.data-store.contacts | ||
(:require [cljs.test :refer-macros [deftest is testing]] | ||
[status-im.data-store.contacts :as c])) | ||
|
||
(deftest contact->rpc | ||
(let [contact {:public-key "pk" | ||
:address "address" | ||
:name "name" | ||
:photo-path "photo-path" | ||
:tribute-to-talk "tribute-to-talk" | ||
:device-info {"1" {:id "1" | ||
:timestamp 1 | ||
:fcm-token "1"} | ||
"2" {:id "2" | ||
:timestamp 2 | ||
:fcm-token 3}} | ||
:last-updated 1 | ||
:system-tags #{:a :b}} | ||
expected-contact {:id "pk" | ||
:address "address" | ||
:name "name" | ||
:photoPath "photo-path" | ||
:tributeToTalk "[\"~#'\",\"tribute-to-talk\"]" | ||
:deviceInfo [{:installationId "1" | ||
:timestamp 1 | ||
:fcmToken "1"} | ||
{:installationId "2" | ||
:timestamp 2 | ||
:fcmToken 3}] | ||
:lastUpdated 1 | ||
:systemTags #{":a" ":b"}}] | ||
(testing "->rpc" | ||
(is (= expected-contact (update | ||
(c/->rpc contact) | ||
:systemTags | ||
#(into #{} %))))))) | ||
|
||
(deftest contact<-rpc | ||
(let [contact {:id "pk" | ||
:address "address" | ||
:name "name" | ||
:photoPath "photo-path" | ||
:tributeToTalk "[\"~#'\",\"tribute-to-talk\"]" | ||
|
||
:deviceInfo [{:installationId "1" | ||
:timestamp 1 | ||
:fcmToken "1"} | ||
{:installationId "2" | ||
:timestamp 2 | ||
:fcmToken 3}] | ||
:lastUpdated 1 | ||
:systemTags [":a" ":b"]} | ||
expected-contact {:public-key "pk" | ||
:address "address" | ||
:name "name" | ||
:photo-path "photo-path" | ||
:tribute-to-talk "tribute-to-talk" | ||
:device-info {"1" {:id "1" | ||
:timestamp 1 | ||
:fcm-token "1"} | ||
"2" {:id "2" | ||
:timestamp 2 | ||
:fcm-token 3}} | ||
:last-updated 1 | ||
:system-tags #{:a :b}}] | ||
(testing "<-rpc" | ||
(is (= expected-contact (c/<-rpc contact)))))) | ||
|
Oops, something went wrong.