Skip to content

Commit 8ed1fc2

Browse files
committed
fixup! WIP
1 parent 18df765 commit 8ed1fc2

File tree

5 files changed

+9
-19
lines changed

5 files changed

+9
-19
lines changed

Makefile

+3-1
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,9 @@ lint-fix: ##@test Run code style checks and fix issues
266266

267267
test: export TARGET := clojure
268268
test: ##@test Run tests once in NodeJS
269-
echo 0
269+
yarn shadow-cljs compile mocks && \
270+
yarn shadow-cljs compile test && \
271+
node --require ./test-resources/override.js target/test/test.js
270272

271273
coverage: ##@test Run tests once in NodeJS generating coverage
272274
@scripts/run-coverage.sh

src/status_im/chat/db_test.cljs

-12
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,6 @@
4141
(is (= {:type :datemark
4242
:value "Dec 31, 1999"} d2)))))
4343

44-
(deftest active-chats-test
45-
(with-redefs [gfycat/generate-gfy (constantly "generated")
46-
identicon/identicon (constantly "generated")]
47-
(let [active-chat-1 {:is-active true :chat-id "1"}
48-
active-chat-2 {:is-active true :chat-id "2"}
49-
chats {"1" active-chat-1
50-
"2" active-chat-2
51-
"3" {:is-active false :chat-id "3"}}]
52-
(testing "it returns only chats with is-active"
53-
(is (= #{"1" "2"}
54-
(set (keys (db/active-chats {} chats {})))))))))
55-
5644
(deftest add-gaps
5745
(testing "empty state"
5846
(is (empty?

src/status_im/chat/models/message.cljs

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
(fx/defn rebuild-message-list
3030
[{:keys [db]} chat-id]
31-
{:db (assoc-in db [:chats chat-id :message-list]
31+
{:db (assoc-in db [:message-lists chat-id]
3232
(message-list/add-many nil (vals (get-in db [:messages chat-id]))))})
3333

3434
(fx/defn hidden-message-marked-as-seen

src/status_im/chat/models/message_test.cljs

+3-1
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,8 @@
270270
(testing "Deleting message deletes it along with all references"
271271
(is (= '(0)
272272
(keys (get-in fx1 [:db :messages "chat-id"]))))
273+
(do
274+
(println fx1))
273275
(is (= [{:one-to-one? false
274276
:message-id 0
275277
:whisper-timestamp 0
@@ -290,6 +292,6 @@
290292
(models.message-list/->seq
291293
(get-in fx1 [:db :message-lists "chat-id"]))))
292294
(is (= {}
293-
(get-in fx2 [:db :message-lists "chat-id"])))
295+
(get-in fx2 [:db :messages "chat-id"])))
294296
(is (= nil
295297
(get-in fx2 [:db :message-lists "chat-id"])))))))

src/status_im/data_store/chats_test.cljs

+2-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
(deftest ->to-rpc
66
(let [chat {:public? false
77
:group-chat true
8-
:message-list []
98
:color "color"
109
:contacts #{"a" "b" "c" "d"}
1110
:last-clock-value 10
@@ -15,11 +14,9 @@
1514
:membership-update-events :events
1615
:unviewed-messages-count 2
1716
:is-active true
18-
:pagination-info {}
1917
:chat-id "chat-id"
2018
:loaded-unviewed-messages-ids []
21-
:timestamp 2
22-
:messages-initialized? true}
19+
:timestamp 2}
2320
expected-chat {:id "chat-id"
2421
:color "color"
2522
:name "name"
@@ -71,6 +68,7 @@
7168
expected-chat {:public? false
7269
:group-chat true
7370
:color "color"
71+
:chat-name "name"
7472
:contacts #{"a" "b" "c" "d"}
7573
:last-clock-value 10
7674
:last-message nil

0 commit comments

Comments
 (0)