mirror of
https://github.com/status-im/status-mobile.git
synced 2025-01-28 01:16:50 +00:00
fixed chat tests
This commit is contained in:
parent
a813ff9e9f
commit
46dc16599b
@ -4,7 +4,7 @@
|
|||||||
[re-frame.core :as rf]
|
[re-frame.core :as rf]
|
||||||
[day8.re-frame.test :refer [run-test-sync]]
|
[day8.re-frame.test :refer [run-test-sync]]
|
||||||
[status-im.constants :as const]
|
[status-im.constants :as const]
|
||||||
[status-im.chat.sign-up :as sign-up]
|
[status-im.chat.console :as console-chat]
|
||||||
[status-im.chat.events :as chat-events]))
|
[status-im.chat.events :as chat-events]))
|
||||||
|
|
||||||
(def contact
|
(def contact
|
||||||
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
(deftest init-console-chat
|
(deftest init-console-chat
|
||||||
(testing "initialising console if console is already added to chats, should not modify anything"
|
(testing "initialising console if console is already added to chats, should not modify anything"
|
||||||
(let [db {:chats {const/console-chat-id sign-up/console-chat}}
|
(let [db {:chats {const/console-chat-id console-chat/chat}}
|
||||||
fx (chat-events/init-console-chat db)]
|
fx (chat-events/init-console-chat db)]
|
||||||
(is (= db (:db fx)))
|
(is (= db (:db fx)))
|
||||||
(is (= #{:db} (-> fx keys set)))))
|
(is (= #{:db} (-> fx keys set)))))
|
||||||
@ -26,19 +26,15 @@
|
|||||||
:accounts/current-account-id nil}
|
:accounts/current-account-id nil}
|
||||||
{:keys [db dispatch-n]} (chat-events/init-console-chat fresh-db)]
|
{:keys [db dispatch-n]} (chat-events/init-console-chat fresh-db)]
|
||||||
(is (= (:current-chat-id db)
|
(is (= (:current-chat-id db)
|
||||||
(:chat-id sign-up/console-chat)))
|
(:chat-id console-chat/chat)))
|
||||||
(is (= (:current-chat-id db)
|
(is (= (:current-chat-id db)
|
||||||
const/console-chat-id))
|
const/console-chat-id))))
|
||||||
(is (= dispatch-n
|
|
||||||
[[:add-contacts [sign-up/console-contact]]
|
|
||||||
sign-up/intro-event]))))
|
|
||||||
|
|
||||||
(testing "initialising console with existing account and console chat not initialisated"
|
(testing "initialising console with existing account and console chat not initialisated"
|
||||||
(let [fresh-db {:chats {}
|
(let [fresh-db {:chats {}
|
||||||
:accounts/current-account-id (:whisper-identity contact)}
|
:accounts/current-account-id (:whisper-identity contact)}
|
||||||
{:keys [db dispatch-n]} (chat-events/init-console-chat fresh-db)]
|
{:keys [db dispatch-n]} (chat-events/init-console-chat fresh-db)]
|
||||||
(is (= (:current-chat-id db)
|
(is (= (:current-chat-id db)
|
||||||
(:chat-id sign-up/console-chat)))
|
(:chat-id console-chat/chat)))
|
||||||
(is (= (:current-chat-id db)
|
(is (= (:current-chat-id db)
|
||||||
const/console-chat-id))
|
const/console-chat-id)))))
|
||||||
(is (= dispatch-n [[:add-contacts [sign-up/console-contact]]])))))
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user