|
1 | 1 | (ns legacy.status-im.data-store.activities-test
|
2 | 2 | (:require
|
3 |
| - [cljs.test :refer [deftest is testing]] |
| 3 | + [cljs.test :refer [deftest is]] |
4 | 4 | [legacy.status-im.data-store.activities :as store]
|
5 | 5 | [status-im.constants :as constants]
|
6 | 6 | [status-im.contexts.shell.activity-center.notification-types :as notification-types]))
|
|
18 | 18 | :name chat-name
|
19 | 19 | :replyMessage {}})
|
20 | 20 |
|
21 |
| -(deftest <-rpc-test |
22 |
| - (testing "renames keys" |
23 |
| - (is (= {:name chat-name |
24 |
| - :chat-id chat-id |
25 |
| - :contact-verification-status constants/contact-verification-status-pending} |
26 |
| - (-> raw-notification |
27 |
| - store/<-rpc |
28 |
| - (dissoc :last-message :message :reply-message))))) |
29 |
| - |
30 |
| - (testing "transforms messages from RPC response" |
31 |
| - (is |
32 |
| - (= {:last-message {:quoted-message nil |
33 |
| - :outgoing-status nil |
34 |
| - :command-parameters nil |
35 |
| - :link-previews [] |
36 |
| - :content {:sticker nil |
37 |
| - :rtl? nil |
38 |
| - :ens-name nil |
39 |
| - :parsed-text nil |
40 |
| - :response-to nil |
41 |
| - :chat-id nil |
42 |
| - :image nil |
43 |
| - :line-count nil |
44 |
| - :links nil |
45 |
| - :text nil} |
46 |
| - :outgoing false} |
47 |
| - :message nil |
48 |
| - :reply-message {:quoted-message nil |
49 |
| - :outgoing-status nil |
50 |
| - :command-parameters nil |
51 |
| - :link-previews [] |
52 |
| - :content {:sticker nil |
53 |
| - :rtl? nil |
54 |
| - :ens-name nil |
55 |
| - :parsed-text nil |
56 |
| - :response-to nil |
57 |
| - :chat-id nil |
58 |
| - :image nil |
59 |
| - :line-count nil |
60 |
| - :links nil |
61 |
| - :text nil} |
62 |
| - :outgoing false}} |
63 |
| - (-> raw-notification |
64 |
| - store/<-rpc |
65 |
| - (select-keys [:last-message :message :reply-message]))))) |
66 |
| - |
67 |
| - (testing "augments notification based on its type" |
68 |
| - (is (= {:chat-name chat-name |
69 |
| - :chat-type constants/private-group-chat-type |
70 |
| - :name chat-name} |
71 |
| - (-> raw-notification |
72 |
| - (assoc :type notification-types/reply) |
73 |
| - store/<-rpc |
74 |
| - (select-keys [:name :chat-type :chat-name :public? :group-chat])))) |
75 |
| - |
76 |
| - (is (= {:chat-name chat-name |
77 |
| - :chat-type constants/private-group-chat-type |
78 |
| - :name chat-name} |
79 |
| - (-> raw-notification |
80 |
| - (assoc :type notification-types/mention) |
81 |
| - store/<-rpc |
82 |
| - (select-keys [:name :chat-type :chat-name :public? :group-chat])))) |
83 |
| - |
84 |
| - (is (= {:chat-name chat-name |
85 |
| - :chat-type constants/private-group-chat-type |
86 |
| - :group-chat true |
87 |
| - :name chat-name |
88 |
| - :public? false} |
89 |
| - (-> raw-notification |
90 |
| - (assoc :type notification-types/private-group-chat) |
91 |
| - store/<-rpc |
92 |
| - (select-keys [:name :chat-type :chat-name :public? :group-chat])))) |
93 |
| - |
94 |
| - (is (= {:chat-name chat-name |
95 |
| - :chat-type constants/one-to-one-chat-type |
96 |
| - :group-chat false |
97 |
| - :name chat-name |
98 |
| - :public? false} |
99 |
| - (-> raw-notification |
100 |
| - (assoc :type notification-types/one-to-one-chat) |
101 |
| - store/<-rpc |
102 |
| - (select-keys [:name :chat-type :chat-name :public? :group-chat])))))) |
103 |
| - |
104 | 21 | (deftest remove-pending-contact-request-test
|
105 | 22 | (is (true? (store/pending-contact-request?
|
106 | 23 | "contact-id"
|
|
0 commit comments