reformat test namespaces
This commit is contained in:
parent
0082f5dd95
commit
6e34ede299
|
@ -44,9 +44,9 @@
|
||||||
(rf/reg-fx ::account-events/send-keys-update #())
|
(rf/reg-fx ::account-events/send-keys-update #())
|
||||||
|
|
||||||
(rf/reg-cofx
|
(rf/reg-cofx
|
||||||
::account-events/get-all-accounts
|
::account-events/get-all-accounts
|
||||||
(fn [coeffects _]
|
(fn [coeffects _]
|
||||||
(assoc coeffects :all-accounts [account-from-realm]))))
|
(assoc coeffects :all-accounts [account-from-realm]))))
|
||||||
|
|
||||||
#_(deftest accounts-events
|
#_(deftest accounts-events
|
||||||
"load-accounts
|
"load-accounts
|
||||||
|
@ -56,26 +56,26 @@
|
||||||
|
|
||||||
(run-test-sync
|
(run-test-sync
|
||||||
|
|
||||||
(test-fixtures)
|
(test-fixtures)
|
||||||
|
|
||||||
(rf/dispatch [:initialize-db])
|
(rf/dispatch [:initialize-db])
|
||||||
(rf/dispatch [:set :accounts/current-account-id account-id])
|
(rf/dispatch [:set :accounts/current-account-id account-id])
|
||||||
|
|
||||||
(let [accounts (rf/subscribe [:get-accounts])]
|
(let [accounts (rf/subscribe [:get-accounts])]
|
||||||
|
|
||||||
(testing ":load-accounts event"
|
(testing ":load-accounts event"
|
||||||
|
|
||||||
;;Assert the initial state
|
;;Assert the initial state
|
||||||
(is (and (map? @accounts) (empty? @accounts)))
|
(is (and (map? @accounts) (empty? @accounts)))
|
||||||
|
|
||||||
(rf/dispatch [:load-accounts])
|
(rf/dispatch [:load-accounts])
|
||||||
|
|
||||||
(is (= {(:address account-from-realm) account-from-realm} @accounts)))
|
(is (= {(:address account-from-realm) account-from-realm} @accounts)))
|
||||||
|
|
||||||
(testing ":add-account event"
|
(testing ":add-account event"
|
||||||
(let [new-account' (assoc new-account :network constants/default-network)]
|
(let [new-account' (assoc new-account :network constants/default-network)]
|
||||||
|
|
||||||
(rf/dispatch [:add-account new-account])
|
(rf/dispatch [:add-account new-account])
|
||||||
|
|
||||||
(is (= {(:address account-from-realm) account-from-realm
|
(is (= {(:address account-from-realm) account-from-realm
|
||||||
(:address new-account) new-account'} @accounts)))))))
|
(:address new-account) new-account'} @accounts)))))))
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
[status-im.bots.events :as bots-events]))
|
[status-im.bots.events :as bots-events]))
|
||||||
|
|
||||||
(def ^:private initial-db
|
(def ^:private initial-db
|
||||||
{:bot-db {}
|
{:bot-db {}
|
||||||
:contacts/contacts
|
:contacts/contacts
|
||||||
{"bot1" {:subscriptions
|
{"bot1" {:subscriptions
|
||||||
{:feeExplanation
|
{:feeExplanation
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
(deftest add-active-bot-subscriptions-test
|
(deftest add-active-bot-subscriptions-test
|
||||||
(testing "That active bot subscriptions are correctly transformed and added to db"
|
(testing "That active bot subscriptions are correctly transformed and added to db"
|
||||||
(let [db (update-in initial-db [:contacts/contacts "bot1" :subscriptions]
|
(let [db (update-in initial-db [:contacts/contacts "bot1" :subscriptions]
|
||||||
bots-events/transform-bot-subscriptions)]
|
bots-events/transform-bot-subscriptions)]
|
||||||
(is (= {[:sliderValue] {:feeExplanation {:fee [:sliderValue]
|
(is (= {[:sliderValue] {:feeExplanation {:fee [:sliderValue]
|
||||||
:tx [:transaction]}}
|
:tx [:transaction]}}
|
||||||
[:transaction] {:feeExplanation {:fee [:sliderValue]
|
[:transaction] {:feeExplanation {:fee [:sliderValue]
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
(bots-events/set-in-bot-db {:bot "bot1"
|
(bots-events/set-in-bot-db {:bot "bot1"
|
||||||
:path [:sliderValue]
|
:path [:sliderValue]
|
||||||
:value 2}))
|
:value 2}))
|
||||||
new-db (reduce fake-subscription-call db call-jail-function-n)]
|
new-db (reduce fake-subscription-call db call-jail-function-n)]
|
||||||
(testing "That setting in value in bot-db correctly updates bot-db"
|
(testing "That setting in value in bot-db correctly updates bot-db"
|
||||||
(is (= 2 (get-in new-db [:bot-db "bot1" :sliderValue]))))
|
(is (= 2 (get-in new-db [:bot-db "bot1" :sliderValue]))))
|
||||||
(testing "That subscriptions are fired-off"
|
(testing "That subscriptions are fired-off"
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
(testing "it updates it if is-active is passed"
|
(testing "it updates it if is-active is passed"
|
||||||
(is (get-in (chat/upsert-chat (assoc chat-props :is-active true) cofx) [:db :chats chat-id :is-active])))
|
(is (get-in (chat/upsert-chat (assoc chat-props :is-active true) cofx) [:db :chats chat-id :is-active])))
|
||||||
(testing "it returns the db unchanged"
|
(testing "it returns the db unchanged"
|
||||||
(is (= {:db (:db cofx)} (chat/upsert-chat chat-props cofx)))))))
|
(is (= {:db (:db cofx)} (chat/upsert-chat chat-props cofx)))))))
|
||||||
|
|
||||||
(deftest add-group-chat
|
(deftest add-group-chat
|
||||||
(let [chat-id "chat-id"
|
(let [chat-id "chat-id"
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
:from "a"
|
:from "a"
|
||||||
:chat-id "a"}))))
|
:chat-id "a"}))))
|
||||||
(testing "it returns false when it's already in the not-loaded-message-ids"
|
(testing "it returns false when it's already in the not-loaded-message-ids"
|
||||||
(is (not (message/add-to-chat? {:db {:chats {"a" {:not-loaded-message-ids #{"message-id" }}}}}
|
(is (not (message/add-to-chat? {:db {:chats {"a" {:not-loaded-message-ids #{"message-id"}}}}}
|
||||||
{:message-id "message-id"
|
{:message-id "message-id"
|
||||||
:from "a"
|
:from "a"
|
||||||
:chat-id "a"})))))
|
:chat-id "a"})))))
|
||||||
|
@ -41,21 +41,21 @@
|
||||||
(is (= #{"1"} (:message-ids (extract-seen (message/receive message db))))))
|
(is (= #{"1"} (:message-ids (extract-seen (message/receive message db))))))
|
||||||
(testing "it does not send any when the chat is public"
|
(testing "it does not send any when the chat is public"
|
||||||
(is (nil? (extract-seen
|
(is (nil? (extract-seen
|
||||||
(message/receive
|
(message/receive
|
||||||
message
|
message
|
||||||
(assoc-in db [:db :chats "chat-id" :public?] true))))))
|
(assoc-in db [:db :chats "chat-id" :public?] true))))))
|
||||||
(testing "it does not send any when we are in a different chat"
|
(testing "it does not send any when we are in a different chat"
|
||||||
(is (nil? (extract-seen
|
(is (nil? (extract-seen
|
||||||
(message/receive
|
(message/receive
|
||||||
message
|
message
|
||||||
(assoc-in db [:db :current-chat-id] :different))))))
|
(assoc-in db [:db :current-chat-id] :different))))))
|
||||||
(testing "it does not send any when we are not in a chat view"
|
(testing "it does not send any when we are not in a chat view"
|
||||||
(is (nil? (extract-seen
|
(is (nil? (extract-seen
|
||||||
(message/receive
|
(message/receive
|
||||||
message
|
message
|
||||||
(assoc-in db [:db :view-id] :home))))))
|
(assoc-in db [:db :view-id] :home))))))
|
||||||
(testing "it does not send any when no public key is in account"
|
(testing "it does not send any when no public key is in account"
|
||||||
(is (nil? (extract-seen
|
(is (nil? (extract-seen
|
||||||
(message/receive
|
(message/receive
|
||||||
message
|
message
|
||||||
(assoc-in db [:db :account/account :public-key] nil))))))))
|
(assoc-in db [:db :account/account :public-key] nil))))))))
|
||||||
|
|
|
@ -12,44 +12,44 @@
|
||||||
[status-im.utils.datetime :as datetime]))
|
[status-im.utils.datetime :as datetime]))
|
||||||
|
|
||||||
(def test-contact-group
|
(def test-contact-group
|
||||||
{:group-id "1501682106404-685e041e-38e7-593e-b42c-fb4cabd7faa4"
|
{:group-id "1501682106404-685e041e-38e7-593e-b42c-fb4cabd7faa4"
|
||||||
:name "Test"
|
:name "Test"
|
||||||
:timestamp 0
|
:timestamp 0
|
||||||
:order 0
|
:order 0
|
||||||
:pending? false
|
:pending? false
|
||||||
:contacts (list
|
:contacts (list
|
||||||
{:identity "bchat"}
|
{:identity "bchat"}
|
||||||
{:identity "Commiteth"}
|
{:identity "Commiteth"}
|
||||||
{:identity "demo-bot"})})
|
{:identity "demo-bot"})})
|
||||||
|
|
||||||
(def dapps-contact-group
|
(def dapps-contact-group
|
||||||
{:group-id "dapps"
|
{:group-id "dapps"
|
||||||
:name "ÐApps"
|
:name "ÐApps"
|
||||||
:order 1
|
:order 1
|
||||||
:timestamp 0
|
:timestamp 0
|
||||||
:contacts [{:identity "oaken-water-meter"}
|
:contacts [{:identity "oaken-water-meter"}
|
||||||
{:identity "melonport"}
|
{:identity "melonport"}
|
||||||
{:identity "bchat"}
|
{:identity "bchat"}
|
||||||
{:identity "Dentacoin"}
|
{:identity "Dentacoin"}
|
||||||
{:identity "Augur"}
|
{:identity "Augur"}
|
||||||
{:identity "Ethlance"}
|
{:identity "Ethlance"}
|
||||||
{:identity "Commiteth"}]
|
{:identity "Commiteth"}]
|
||||||
:pending? false})
|
:pending? false})
|
||||||
|
|
||||||
(def demo-bot-contact
|
(def demo-bot-contact
|
||||||
{:address nil
|
{:address nil
|
||||||
:name "Demo bot"
|
:name "Demo bot"
|
||||||
:description nil
|
:description nil
|
||||||
:hide-contact? false
|
:hide-contact? false
|
||||||
:dapp-hash nil
|
:dapp-hash nil
|
||||||
:photo-path nil
|
:photo-path nil
|
||||||
:dapp-url nil
|
:dapp-url nil
|
||||||
:bot-url "local://demo-bot"
|
:bot-url "local://demo-bot"
|
||||||
:whisper-identity "demo-bot"
|
:whisper-identity "demo-bot"
|
||||||
:dapp? true
|
:dapp? true
|
||||||
:pending? false
|
:pending? false
|
||||||
:unremovable? false
|
:unremovable? false
|
||||||
:public-key nil})
|
:public-key nil})
|
||||||
|
|
||||||
(def console-contact
|
(def console-contact
|
||||||
{:whisper-identity "console"
|
{:whisper-identity "console"
|
||||||
|
@ -79,27 +79,27 @@
|
||||||
(rf/reg-fx :data-store/save-chat #())
|
(rf/reg-fx :data-store/save-chat #())
|
||||||
|
|
||||||
(rf/reg-cofx
|
(rf/reg-cofx
|
||||||
:data-store/get-all-contacts
|
:data-store/get-all-contacts
|
||||||
(fn [coeffects _]
|
(fn [coeffects _]
|
||||||
(assoc coeffects :all-contacts [])))
|
(assoc coeffects :all-contacts [])))
|
||||||
|
|
||||||
(rf/reg-cofx
|
(rf/reg-cofx
|
||||||
:data-store/get-local-storage-data
|
:data-store/get-local-storage-data
|
||||||
(fn [cofx]
|
(fn [cofx]
|
||||||
(assoc cofx :get-local-storage-data (constantly nil))))
|
(assoc cofx :get-local-storage-data (constantly nil))))
|
||||||
|
|
||||||
(rf/reg-cofx
|
(rf/reg-cofx
|
||||||
::group-events/get-all-contact-groups
|
::group-events/get-all-contact-groups
|
||||||
(fn [coeffects _]
|
(fn [coeffects _]
|
||||||
(assoc coeffects :all-groups {(:group-id test-contact-group) test-contact-group})))
|
(assoc coeffects :all-groups {(:group-id test-contact-group) test-contact-group})))
|
||||||
|
|
||||||
;;TODO implement tests later for :add-chat? and :bot-url
|
;;TODO implement tests later for :add-chat? and :bot-url
|
||||||
(rf/reg-cofx
|
(rf/reg-cofx
|
||||||
::contacts-events/get-default-contacts-and-groups
|
::contacts-events/get-default-contacts-and-groups
|
||||||
(fn [coeffects _]
|
(fn [coeffects _]
|
||||||
(assoc coeffects
|
(assoc coeffects
|
||||||
:default-contacts (select-keys js-res/default-contacts [:demo-bot])
|
:default-contacts (select-keys js-res/default-contacts [:demo-bot])
|
||||||
:default-groups (select-keys js-res/default-contact-groups [:dapps])))))
|
:default-groups (select-keys js-res/default-contact-groups [:dapps])))))
|
||||||
|
|
||||||
#_(deftest contacts-events
|
#_(deftest contacts-events
|
||||||
"load-contacts
|
"load-contacts
|
||||||
|
@ -122,7 +122,7 @@
|
||||||
delete-contact-group"
|
delete-contact-group"
|
||||||
|
|
||||||
(testing "watch-contact"
|
(testing "watch-contact"
|
||||||
(let [contact {:public-key "public-key"
|
(let [contact {:public-key "public-key"
|
||||||
:whisper-identity "whisper-identity"}
|
:whisper-identity "whisper-identity"}
|
||||||
actual-fx (-> {:db {:web3 "web3"}}
|
actual-fx (-> {:db {:web3 "web3"}}
|
||||||
(contacts-events/watch-contact contact)
|
(contacts-events/watch-contact contact)
|
||||||
|
@ -141,16 +141,16 @@
|
||||||
(is (= "public-key" (:public-key actual-fx))))))
|
(is (= "public-key" (:public-key actual-fx))))))
|
||||||
|
|
||||||
(testing "send-contact-request"
|
(testing "send-contact-request"
|
||||||
(let [contact {:whisper-identity "contact-whisper-identity"}
|
(let [contact {:whisper-identity "contact-whisper-identity"}
|
||||||
account {:name "name"
|
account {:name "name"
|
||||||
:photo-path "photo-path"
|
:photo-path "photo-path"
|
||||||
:status "status"}
|
:status "status"}
|
||||||
accounts {"current-account-id" account}
|
accounts {"current-account-id" account}
|
||||||
db {:accounts/accounts accounts
|
db {:accounts/accounts accounts
|
||||||
:accounts/current-account-id "current-account-id"
|
:accounts/current-account-id "current-account-id"
|
||||||
:web3 "web3"
|
:web3 "web3"
|
||||||
:current-public-key "current-public-key"
|
:current-public-key "current-public-key"
|
||||||
:notifications {:fcm-token "fcm-token"}}
|
:notifications {:fcm-token "fcm-token"}}
|
||||||
actual-fx (-> {:db db}
|
actual-fx (-> {:db db}
|
||||||
(contacts-events/send-contact-request contact)
|
(contacts-events/send-contact-request contact)
|
||||||
::contacts-events/send-contact-request-fx)]
|
::contacts-events/send-contact-request-fx)]
|
||||||
|
@ -180,274 +180,272 @@
|
||||||
|
|
||||||
(run-test-sync
|
(run-test-sync
|
||||||
|
|
||||||
(test-fixtures)
|
(test-fixtures)
|
||||||
|
|
||||||
(rf/dispatch [:initialize-db])
|
(rf/dispatch [:initialize-db])
|
||||||
|
|
||||||
(def contacts (rf/subscribe [:get-contacts]))
|
(def contacts (rf/subscribe [:get-contacts]))
|
||||||
(def contact-groups (rf/subscribe [:get-contact-groups]))
|
(def contact-groups (rf/subscribe [:get-contact-groups]))
|
||||||
(def view-id (rf/subscribe [:get :view-id]))
|
(def view-id (rf/subscribe [:get :view-id]))
|
||||||
|
|
||||||
(testing ":load-contacts event"
|
(testing ":load-contacts event"
|
||||||
|
|
||||||
;;Assert the initial state
|
;;Assert the initial state
|
||||||
(is (and (map? @contacts) (empty? @contacts)))
|
(is (and (map? @contacts) (empty? @contacts)))
|
||||||
(rf/dispatch [:load-contacts]))
|
(rf/dispatch [:load-contacts]))
|
||||||
|
|
||||||
(testing ":load-contact-groups event"
|
(testing ":load-contact-groups event"
|
||||||
|
|
||||||
;;Assert the initial state
|
;;Assert the initial state
|
||||||
(is (and (map? @contact-groups) (empty? @contact-groups)))
|
(is (and (map? @contact-groups) (empty? @contact-groups)))
|
||||||
(rf/dispatch [:load-contact-groups])
|
(rf/dispatch [:load-contact-groups])
|
||||||
(is (= {(:group-id test-contact-group) test-contact-group}
|
(is (= {(:group-id test-contact-group) test-contact-group}
|
||||||
@contact-groups)))
|
@contact-groups)))
|
||||||
|
|
||||||
(testing ":load-default-contacts! event"
|
(testing ":load-default-contacts! event"
|
||||||
|
|
||||||
;; :load-default-contacts! event dispatches next 5 events
|
;; :load-default-contacts! event dispatches next 5 events
|
||||||
;;
|
;;
|
||||||
;; :add-contact-groups
|
;; :add-contact-groups
|
||||||
;; :add-contacts
|
;; :add-contacts
|
||||||
;; :add-contacts-to-group
|
;; :add-contacts-to-group
|
||||||
;;TODO :add-chat
|
;;TODO :add-chat
|
||||||
;;TODO :load-commands!
|
;;TODO :load-commands!
|
||||||
(rf/dispatch [:load-default-contacts!])
|
(rf/dispatch [:load-default-contacts!])
|
||||||
|
|
||||||
(rf/dispatch [:set-in [:group/contact-groups "dapps" :timestamp] 0])
|
(rf/dispatch [:set-in [:group/contact-groups "dapps" :timestamp] 0])
|
||||||
|
|
||||||
(is (= {"dapps" dapps-contact-group
|
(is (= {"dapps" dapps-contact-group
|
||||||
(:group-id test-contact-group) test-contact-group}
|
(:group-id test-contact-group) test-contact-group}
|
||||||
@contact-groups))
|
@contact-groups))
|
||||||
|
|
||||||
(testing "it adds a default contact"
|
(testing "it adds a default contact"
|
||||||
(is (= demo-bot-contact (get @contacts "demo-bot"))))
|
(is (= demo-bot-contact (get @contacts "demo-bot"))))
|
||||||
|
|
||||||
(testing "it adds the console bot"
|
(testing "it adds the console bot"
|
||||||
(is (= console-contact (get @contacts "console"))))
|
(is (= console-contact (get @contacts "console"))))
|
||||||
|
|
||||||
(testing "it does not add any other contact"
|
(testing "it does not add any other contact"
|
||||||
(is (= 2 (count (keys @contacts))))))
|
(is (= 2 (count (keys @contacts))))))
|
||||||
|
|
||||||
(def new-contact-public-key "0x048f7d5d4bda298447bbb5b021a34832509bd1a8dbe4e06f9b7223d00a59b6dc14f6e142b21d3220ceb3155a6d8f40ec115cd96394d3cc7c55055b433a1758dc74")
|
(def new-contact-public-key "0x048f7d5d4bda298447bbb5b021a34832509bd1a8dbe4e06f9b7223d00a59b6dc14f6e142b21d3220ceb3155a6d8f40ec115cd96394d3cc7c55055b433a1758dc74")
|
||||||
(def new-contact-address "5392ccb49f2e9fef8b8068b3e3b5ba6c020a9aca")
|
(def new-contact-address "5392ccb49f2e9fef8b8068b3e3b5ba6c020a9aca")
|
||||||
(def new-contact {:name ""
|
(def new-contact {:name ""
|
||||||
:photo-path ""
|
:photo-path ""
|
||||||
:whisper-identity new-contact-public-key
|
:whisper-identity new-contact-public-key
|
||||||
:address new-contact-address
|
:address new-contact-address
|
||||||
:pending? false})
|
:pending? false})
|
||||||
(def contact (rf/subscribe [:contact-by-identity new-contact-public-key]))
|
(def contact (rf/subscribe [:contact-by-identity new-contact-public-key]))
|
||||||
(def current-chat-id (rf/subscribe [:get-current-chat-id]))
|
(def current-chat-id (rf/subscribe [:get-current-chat-id]))
|
||||||
|
|
||||||
(testing ":add-contact-handler event - new contact"
|
(testing ":add-contact-handler event - new contact"
|
||||||
|
|
||||||
(rf/dispatch [:set :view-id nil])
|
(rf/dispatch [:set :view-id nil])
|
||||||
(rf/dispatch [:set :current-chat-id nil])
|
(rf/dispatch [:set :current-chat-id nil])
|
||||||
|
|
||||||
;; :add-contact-handler event dispatches next 4 events for new contact
|
;; :add-contact-handler event dispatches next 4 events for new contact
|
||||||
;;
|
;;
|
||||||
;; :add-new-contact-and-open-chat
|
;; :add-new-contact-and-open-chat
|
||||||
;; :status-im.contacts.events/add-new-contact
|
;; :status-im.contacts.events/add-new-contact
|
||||||
;; :status-im.contacts.events/send-contact-request
|
;; :status-im.contacts.events/send-contact-request
|
||||||
;;TODO :start-chat
|
;;TODO :start-chat
|
||||||
|
|
||||||
(rf/dispatch [:set :contacts/new-identity new-contact-public-key])
|
(rf/dispatch [:set :contacts/new-identity new-contact-public-key])
|
||||||
(rf/dispatch [:add-contact-handler])
|
(rf/dispatch [:add-contact-handler])
|
||||||
|
|
||||||
(testing "it returns the new contact from the contact-by-identity sub"
|
(testing "it returns the new contact from the contact-by-identity sub"
|
||||||
(is (= new-contact (assoc @contact :photo-path "" :name ""))))
|
(is (= new-contact (assoc @contact :photo-path "" :name ""))))
|
||||||
|
|
||||||
(testing "it adds the new contact to the list of contacts"
|
(testing "it adds the new contact to the list of contacts"
|
||||||
(is (= new-contact
|
(is (= new-contact
|
||||||
(-> @contacts
|
(-> @contacts
|
||||||
(get new-contact-public-key)
|
(get new-contact-public-key)
|
||||||
(assoc :photo-path "" :name "")))))
|
(assoc :photo-path "" :name "")))))
|
||||||
|
|
||||||
(testing "it loads the 1-1 chat"
|
(testing "it loads the 1-1 chat"
|
||||||
(is (= :chat @view-id)))
|
(is (= :chat @view-id)))
|
||||||
|
|
||||||
(testing "it adds the new contact to the chat"
|
(testing "it adds the new contact to the chat"
|
||||||
(is (= new-contact-public-key @current-chat-id))))
|
(is (= new-contact-public-key @current-chat-id))))
|
||||||
|
|
||||||
(testing ":contact-request-received event"
|
(testing ":contact-request-received event"
|
||||||
|
|
||||||
;; :contact-request-received event dispatches next 3 events
|
;; :contact-request-received event dispatches next 3 events
|
||||||
;;
|
;;
|
||||||
;; :update-contact!
|
;; :update-contact!
|
||||||
;; :watch-contact
|
;; :watch-contact
|
||||||
;;TODO :update-chat!
|
;;TODO :update-chat!
|
||||||
(rf/reg-event-db :update-chat! (fn [db _] db))
|
(rf/reg-event-db :update-chat! (fn [db _] db))
|
||||||
(def received-contact {:name "test"
|
(def received-contact {:name "test"
|
||||||
:profile-image ""
|
:profile-image ""
|
||||||
:address new-contact-address
|
:address new-contact-address
|
||||||
:status "test status"
|
:status "test status"
|
||||||
:fcm-token "0xwhatever"})
|
:fcm-token "0xwhatever"})
|
||||||
(def received-contact1 (merge new-contact
|
(def received-contact1 (merge new-contact
|
||||||
(dissoc received-contact :profile-image)
|
(dissoc received-contact :profile-image)
|
||||||
{:public-key new-contact-public-key}))
|
{:public-key new-contact-public-key}))
|
||||||
|
|
||||||
(rf/dispatch [:contact-request-received {:from new-contact-public-key
|
(rf/dispatch [:contact-request-received {:from new-contact-public-key
|
||||||
:payload {:contact received-contact}}])
|
:payload {:contact received-contact}}])
|
||||||
|
|
||||||
(testing "it adds the new contact to the list of contacts"
|
(testing "it adds the new contact to the list of contacts"
|
||||||
(is (= received-contact1
|
(is (= received-contact1
|
||||||
(get @contacts new-contact-public-key)))))
|
(get @contacts new-contact-public-key)))))
|
||||||
|
|
||||||
(testing ":contact-update-received event"
|
(testing ":contact-update-received event"
|
||||||
|
|
||||||
;; :contact-update-received event dispatches next 2 events
|
;; :contact-update-received event dispatches next 2 events
|
||||||
;;
|
;;
|
||||||
;; :update-contact!
|
;; :update-contact!
|
||||||
;;TODO :update-chat!
|
;;TODO :update-chat!
|
||||||
(let [timestamp (datetime/timestamp)]
|
(let [timestamp (datetime/timestamp)]
|
||||||
(def received-contact2 (assoc received-contact1
|
(def received-contact2 (assoc received-contact1
|
||||||
:last-updated timestamp
|
:last-updated timestamp
|
||||||
:status "new status"
|
:status "new status"
|
||||||
:name "new name"))
|
:name "new name"))
|
||||||
|
|
||||||
(rf/dispatch [:contact-update-received {:from new-contact-public-key
|
(rf/dispatch [:contact-update-received {:from new-contact-public-key
|
||||||
:payload {:content {:profile {:profile-image ""
|
:payload {:content {:profile {:profile-image ""
|
||||||
:status "new status"
|
:status "new status"
|
||||||
:name "new name"}}
|
:name "new name"}}
|
||||||
:timestamp timestamp}}]))
|
:timestamp timestamp}}]))
|
||||||
|
|
||||||
(testing "it updates the contact and set the :last-updated key"
|
(testing "it updates the contact and set the :last-updated key"
|
||||||
(is (= received-contact2
|
(is (= received-contact2
|
||||||
(get @contacts new-contact-public-key)))))
|
(get @contacts new-contact-public-key)))))
|
||||||
|
|
||||||
(testing ":hide-contact event"
|
(testing ":hide-contact event"
|
||||||
|
|
||||||
;; :hide-contact event dispatches next 2 events
|
;; :hide-contact event dispatches next 2 events
|
||||||
;;
|
;;
|
||||||
;; :update-contact!
|
;; :update-contact!
|
||||||
;;TODO :account-update-keys
|
;;TODO :account-update-keys
|
||||||
(rf/reg-event-db :account-update-keys (fn [db _] db))
|
(rf/reg-event-db :account-update-keys (fn [db _] db))
|
||||||
|
|
||||||
(rf/dispatch [:hide-contact @contact])
|
(rf/dispatch [:hide-contact @contact])
|
||||||
|
|
||||||
(testing "it sets the pending? flag to true"
|
(testing "it sets the pending? flag to true"
|
||||||
(is (= (assoc received-contact2 :pending? true)
|
(is (= (assoc received-contact2 :pending? true)
|
||||||
(get @contacts new-contact-public-key)))))
|
(get @contacts new-contact-public-key)))))
|
||||||
|
|
||||||
(testing ":add-contact-handler event - :add-contact"
|
(testing ":add-contact-handler event - :add-contact"
|
||||||
|
|
||||||
;; :add-contact-handler event dispatches next 4 events
|
;; :add-contact-handler event dispatches next 4 events
|
||||||
;;
|
;;
|
||||||
;; :add-contact
|
;; :add-contact
|
||||||
;; :status-im.contacts.events/add-new-contact
|
;; :status-im.contacts.events/add-new-contact
|
||||||
;; :status-im.contacts.events/send-contact-request
|
;; :status-im.contacts.events/send-contact-request
|
||||||
;;TODO :discoveries-send-portions
|
;;TODO :discoveries-send-portions
|
||||||
(rf/reg-event-db :discoveries-send-portions (fn [db _] db))
|
(rf/reg-event-db :discoveries-send-portions (fn [db _] db))
|
||||||
|
|
||||||
(rf/dispatch [:set :view-id nil])
|
(rf/dispatch [:set :view-id nil])
|
||||||
(rf/dispatch [:set :current-chat-id nil])
|
(rf/dispatch [:set :current-chat-id nil])
|
||||||
(rf/dispatch [:set :contacts/new-identity new-contact-public-key])
|
(rf/dispatch [:set :contacts/new-identity new-contact-public-key])
|
||||||
(rf/dispatch [:add-contact-handler])
|
(rf/dispatch [:add-contact-handler])
|
||||||
|
|
||||||
(testing "it sets the pending? flag to false"
|
(testing "it sets the pending? flag to false"
|
||||||
(is (= (assoc received-contact2 :pending? false)
|
(is (= (assoc received-contact2 :pending? false)
|
||||||
(get @contacts new-contact-public-key))))
|
(get @contacts new-contact-public-key))))
|
||||||
|
|
||||||
(testing "it loads the 1-1 chat"
|
(testing "it loads the 1-1 chat"
|
||||||
(is (= :chat @view-id)))
|
(is (= :chat @view-id)))
|
||||||
|
|
||||||
(testing "it adds the new contact to the chat"
|
(testing "it adds the new contact to the chat"
|
||||||
(is (= new-contact-public-key @current-chat-id))))
|
(is (= new-contact-public-key @current-chat-id))))
|
||||||
|
|
||||||
(testing ":create-new-contact-group event"
|
(testing ":create-new-contact-group event"
|
||||||
|
|
||||||
(def new-group-name "new group")
|
(def new-group-name "new group")
|
||||||
(rf/dispatch [:select-contact new-contact-public-key])
|
(rf/dispatch [:select-contact new-contact-public-key])
|
||||||
(rf/dispatch [:select-contact "demo-bot"])
|
(rf/dispatch [:select-contact "demo-bot"])
|
||||||
(rf/dispatch [:select-contact "browse"])
|
(rf/dispatch [:select-contact "browse"])
|
||||||
(rf/dispatch [:deselect-contact "browse"])
|
(rf/dispatch [:deselect-contact "browse"])
|
||||||
|
|
||||||
(rf/dispatch [:create-new-contact-group new-group-name])
|
(rf/dispatch [:create-new-contact-group new-group-name])
|
||||||
|
|
||||||
(rf/dispatch [:deselect-contact "demo-bot"])
|
(rf/dispatch [:deselect-contact "demo-bot"])
|
||||||
(rf/dispatch [:deselect-contact new-contact-public-key])
|
(rf/dispatch [:deselect-contact new-contact-public-key])
|
||||||
(def new-group-id (->> @contact-groups
|
(def new-group-id (->> @contact-groups
|
||||||
(vals)
|
(vals)
|
||||||
(filter #(= (:name %) new-group-name))
|
(filter #(= (:name %) new-group-name))
|
||||||
(first)
|
(first)
|
||||||
(:group-id)))
|
(:group-id)))
|
||||||
(def new-group {:group-id new-group-id
|
(def new-group {:group-id new-group-id
|
||||||
:name new-group-name
|
:name new-group-name
|
||||||
:order 2
|
:order 2
|
||||||
:timestamp 0
|
:timestamp 0
|
||||||
:contacts [{:identity new-contact-public-key}
|
:contacts [{:identity new-contact-public-key}
|
||||||
{:identity "demo-bot"}]})
|
{:identity "demo-bot"}]})
|
||||||
(def groups-with-new-group {new-group-id new-group
|
(def groups-with-new-group {new-group-id new-group
|
||||||
"dapps" dapps-contact-group
|
"dapps" dapps-contact-group
|
||||||
(:group-id test-contact-group) test-contact-group})
|
(:group-id test-contact-group) test-contact-group})
|
||||||
(def groups-with-new-group1 (update groups-with-new-group new-group-id assoc :name "new group name"))
|
(def groups-with-new-group1 (update groups-with-new-group new-group-id assoc :name "new group name"))
|
||||||
(def groups-with-new-group2 (-> groups-with-new-group1
|
(def groups-with-new-group2 (-> groups-with-new-group1
|
||||||
(update new-group-id assoc :order 1)
|
(update new-group-id assoc :order 1)
|
||||||
(update "dapps" assoc :order 2)))
|
(update "dapps" assoc :order 2)))
|
||||||
|
|
||||||
(rf/dispatch [:set-in [:group/contact-groups new-group-id :timestamp] 0])
|
(rf/dispatch [:set-in [:group/contact-groups new-group-id :timestamp] 0])
|
||||||
|
|
||||||
(is (= groups-with-new-group @contact-groups)))
|
(is (= groups-with-new-group @contact-groups)))
|
||||||
|
|
||||||
(testing ":set-contact-group-name event"
|
(testing ":set-contact-group-name event"
|
||||||
|
|
||||||
(rf/reg-event-db ::prepare-group-name
|
(rf/reg-event-db ::prepare-group-name
|
||||||
(fn [db _] (assoc db
|
(fn [db _] (assoc db
|
||||||
:new-chat-name "new group name"
|
:new-chat-name "new group name"
|
||||||
:group/contact-group-id new-group-id)))
|
:group/contact-group-id new-group-id)))
|
||||||
|
|
||||||
(rf/dispatch [::prepare-group-name])
|
(rf/dispatch [::prepare-group-name])
|
||||||
(rf/dispatch [:set-contact-group-name])
|
(rf/dispatch [:set-contact-group-name])
|
||||||
|
|
||||||
(is (= groups-with-new-group1 @contact-groups)))
|
(is (= groups-with-new-group1 @contact-groups)))
|
||||||
|
|
||||||
(testing ":save-contact-group-order event"
|
(testing ":save-contact-group-order event"
|
||||||
|
|
||||||
(rf/reg-event-db ::prepare-groups-order
|
(rf/reg-event-db ::prepare-groups-order
|
||||||
(fn [db _]
|
(fn [db _]
|
||||||
(assoc db :group/groups-order
|
(assoc db :group/groups-order
|
||||||
(->> (vals (:group/contact-groups db))
|
(->> (vals (:group/contact-groups db))
|
||||||
(remove :pending?)
|
(remove :pending?)
|
||||||
(sort-by :order >)
|
(sort-by :order >)
|
||||||
(map :group-id)))))
|
(map :group-id)))))
|
||||||
|
|
||||||
(rf/dispatch [::prepare-groups-order])
|
(rf/dispatch [::prepare-groups-order])
|
||||||
(rf/dispatch [:change-contact-group-order 1 0])
|
(rf/dispatch [:change-contact-group-order 1 0])
|
||||||
(rf/dispatch [:save-contact-group-order])
|
(rf/dispatch [:save-contact-group-order])
|
||||||
|
|
||||||
(is (= groups-with-new-group2 @contact-groups)))
|
(is (= groups-with-new-group2 @contact-groups)))
|
||||||
|
|
||||||
(testing ":add-selected-contacts-to-group event"
|
(testing ":add-selected-contacts-to-group event"
|
||||||
|
|
||||||
(rf/dispatch [:select-contact "browse"])
|
(rf/dispatch [:select-contact "browse"])
|
||||||
(rf/dispatch [:add-selected-contacts-to-group])
|
(rf/dispatch [:add-selected-contacts-to-group])
|
||||||
(rf/dispatch [:deselect-contact "browse"])
|
(rf/dispatch [:deselect-contact "browse"])
|
||||||
|
|
||||||
(is (= (update groups-with-new-group2 new-group-id assoc :contacts [{:identity new-contact-public-key}
|
(is (= (update groups-with-new-group2 new-group-id assoc :contacts [{:identity new-contact-public-key}
|
||||||
{:identity "demo-bot"}
|
{:identity "demo-bot"}
|
||||||
{:identity "browse"}])
|
{:identity "browse"}])
|
||||||
@contact-groups)))
|
@contact-groups)))
|
||||||
|
|
||||||
(testing ":remove-contact-from-group event"
|
(testing ":remove-contact-from-group event"
|
||||||
|
|
||||||
(rf/dispatch [:remove-contact-from-group "browse" new-group-id])
|
(rf/dispatch [:remove-contact-from-group "browse" new-group-id])
|
||||||
|
|
||||||
(is (= groups-with-new-group2 @contact-groups)))
|
(is (= groups-with-new-group2 @contact-groups)))
|
||||||
|
(testing ":add-contacts-to-group event"
|
||||||
|
|
||||||
|
(rf/dispatch [:add-contacts-to-group new-group-id ["browse"]])
|
||||||
|
|
||||||
(testing ":add-contacts-to-group event"
|
(is (= (update groups-with-new-group2 new-group-id assoc :contacts [{:identity new-contact-public-key}
|
||||||
|
{:identity "demo-bot"}
|
||||||
|
{:identity "browse"}])
|
||||||
|
@contact-groups))
|
||||||
|
|
||||||
(rf/dispatch [:add-contacts-to-group new-group-id ["browse"]])
|
(rf/dispatch [:remove-contact-from-group "browse" new-group-id]))
|
||||||
|
|
||||||
(is (= (update groups-with-new-group2 new-group-id assoc :contacts [{:identity new-contact-public-key}
|
(testing ":delete-contact-group event"
|
||||||
{:identity "demo-bot"}
|
|
||||||
{:identity "browse"}])
|
|
||||||
@contact-groups))
|
|
||||||
|
|
||||||
(rf/dispatch [:remove-contact-from-group "browse" new-group-id]))
|
(rf/dispatch [:delete-contact-group])
|
||||||
|
|
||||||
(testing ":delete-contact-group event"
|
(is (= (update groups-with-new-group2 new-group-id assoc :pending? true)
|
||||||
|
@contact-groups)))))
|
||||||
(rf/dispatch [:delete-contact-group])
|
|
||||||
|
|
||||||
(is (= (update groups-with-new-group2 new-group-id assoc :pending? true)
|
|
||||||
@contact-groups)))))
|
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
:signing-phrase "baby atom limo"
|
:signing-phrase "baby atom limo"
|
||||||
:public-key "0x04f5722fba79eb36d73263417531007f43d13af76c6233573a8e3e60f667710611feba0785d751b50609bfc0b7cef35448875c5392c0a91948c95798a0ce600847"})
|
:public-key "0x04f5722fba79eb36d73263417531007f43d13af76c6233573a8e3e60f667710611feba0785d751b50609bfc0b7cef35448875c5392c0a91948c95798a0ce600847"})
|
||||||
|
|
||||||
|
|
||||||
(defn test-fixtures []
|
(defn test-fixtures []
|
||||||
(rf/reg-fx ::events/init-store #())
|
(rf/reg-fx ::events/init-store #())
|
||||||
(rf/reg-fx ::account-events/save-account #()))
|
(rf/reg-fx ::account-events/save-account #()))
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
(ns status-im.test.protocol.core
|
(ns status-im.test.protocol.core
|
||||||
(:require [cljs.test :refer-macros [deftest is testing async ]]
|
(:require [cljs.test :refer-macros [deftest is testing async]]
|
||||||
[cljs.nodejs :as nodejs]
|
[cljs.nodejs :as nodejs]
|
||||||
re-frame.db
|
re-frame.db
|
||||||
status-im.ui.screens.events
|
status-im.ui.screens.events
|
||||||
|
@ -29,24 +29,24 @@
|
||||||
(deftest test-send-message!
|
(deftest test-send-message!
|
||||||
(testing "send contact request & message"
|
(testing "send contact request & message"
|
||||||
(run-test-async
|
(run-test-async
|
||||||
(let [web3 (make-web3)
|
(let [web3 (make-web3)
|
||||||
shh (transport.utils/shh web3)
|
shh (transport.utils/shh web3)
|
||||||
from (create-keys shh)]
|
from (create-keys shh)]
|
||||||
(reset! re-frame.db/app-db {:web3 web3
|
(reset! re-frame.db/app-db {:web3 web3
|
||||||
:current-public-key from})
|
:current-public-key from})
|
||||||
|
|
||||||
(rf/reg-fx :data-store/save-chat (constantly nil))
|
(rf/reg-fx :data-store/save-chat (constantly nil))
|
||||||
(rf/reg-fx :data-store/save-message (constantly nil))
|
(rf/reg-fx :data-store/save-message (constantly nil))
|
||||||
(rf/reg-fx :data-store/save-contact (constantly nil))
|
(rf/reg-fx :data-store/save-contact (constantly nil))
|
||||||
(rf/reg-fx :data-store.transport/save (constantly nil))
|
(rf/reg-fx :data-store.transport/save (constantly nil))
|
||||||
(rf/reg-fx :data-store/update-message (constantly nil))
|
(rf/reg-fx :data-store/update-message (constantly nil))
|
||||||
|
|
||||||
(rf/dispatch [:open-chat-with-contact {:whisper-identity contact-whisper-identity}])
|
(rf/dispatch [:open-chat-with-contact {:whisper-identity contact-whisper-identity}])
|
||||||
(rf-test/wait-for [::transport.contact/send-new-sym-key]
|
(rf-test/wait-for [::transport.contact/send-new-sym-key]
|
||||||
(rf/dispatch [:set-chat-input-text "test message"])
|
(rf/dispatch [:set-chat-input-text "test message"])
|
||||||
(rf/dispatch [:send-current-message])
|
(rf/dispatch [:send-current-message])
|
||||||
(rf-test/wait-for [:update-message-status :protocol/send-status-message-error]
|
(rf-test/wait-for [:update-message-status :protocol/send-status-message-error]
|
||||||
(is true)))))))
|
(is true)))))))
|
||||||
|
|
||||||
(deftest test-whisper-version!
|
(deftest test-whisper-version!
|
||||||
(testing "Whisper version supported"
|
(testing "Whisper version supported"
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
[status-im.transport.utils :as utils]
|
[status-im.transport.utils :as utils]
|
||||||
[cljs.test :refer-macros [deftest is testing]]))
|
[cljs.test :refer-macros [deftest is testing]]))
|
||||||
|
|
||||||
|
|
||||||
(def enode "enode://08d8eb6177b187049f6c97ed3f6c74fbbefb94c7ad10bafcaf4b65ce89c314dcfee0a8bc4e7a5b824dfa08b45b360cc78f34f0aff981f8386caa07652d2e601b@163.172.177.138:40404")
|
(def enode "enode://08d8eb6177b187049f6c97ed3f6c74fbbefb94c7ad10bafcaf4b65ce89c314dcfee0a8bc4e7a5b824dfa08b45b360cc78f34f0aff981f8386caa07652d2e601b@163.172.177.138:40404")
|
||||||
(def enode2 "enode://12d8eb6177b187049f6c97ed3f6c74fbbefb94c7ad10bafcaf4b65ce89c314dcfee0a8bc4e7a5b824dfa08b45b360cc78f34f0aff981f8386caa07652d2e601b@163.172.177.138:40404")
|
(def enode2 "enode://12d8eb6177b187049f6c97ed3f6c74fbbefb94c7ad10bafcaf4b65ce89c314dcfee0a8bc4e7a5b824dfa08b45b360cc78f34f0aff981f8386caa07652d2e601b@163.172.177.138:40404")
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
[status-im.test.protocol.web3.inbox]
|
[status-im.test.protocol.web3.inbox]
|
||||||
[status-im.test.utils.utils]
|
[status-im.test.utils.utils]
|
||||||
[status-im.test.utils.money]
|
[status-im.test.utils.money]
|
||||||
[status-im.test.utils.clocks]
|
[status-im.test.utils.clocks]
|
||||||
[status-im.test.utils.ethereum.eip681]
|
[status-im.test.utils.ethereum.eip681]
|
||||||
[status-im.test.utils.ethereum.core]
|
[status-im.test.utils.ethereum.core]
|
||||||
[status-im.test.utils.random]
|
[status-im.test.utils.random]
|
||||||
|
@ -60,7 +60,7 @@
|
||||||
'status-im.test.protocol.web3.inbox
|
'status-im.test.protocol.web3.inbox
|
||||||
'status-im.test.utils.utils
|
'status-im.test.utils.utils
|
||||||
'status-im.test.utils.money
|
'status-im.test.utils.money
|
||||||
'status-im.test.utils.clocks
|
'status-im.test.utils.clocks
|
||||||
'status-im.test.utils.ethereum.eip681
|
'status-im.test.utils.ethereum.eip681
|
||||||
'status-im.test.utils.ethereum.core
|
'status-im.test.utils.ethereum.core
|
||||||
'status-im.test.utils.random
|
'status-im.test.utils.random
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
(str from ": " text ", "))
|
(str from ": " text ", "))
|
||||||
|
|
||||||
(defn format-thread [thread]
|
(defn format-thread [thread]
|
||||||
(apply str (map format-message thread)))
|
(apply str (map format-message thread)))
|
||||||
|
|
||||||
;; Invariant we want to maintain.
|
;; Invariant we want to maintain.
|
||||||
(defn ordered-increasing-text? [thread]
|
(defn ordered-increasing-text? [thread]
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
(with-redefs [t/*ms-fn* (constantly epoch-plus-3d)
|
(with-redefs [t/*ms-fn* (constantly epoch-plus-3d)
|
||||||
d/time-fmt (d/mk-fmt "us" d/short-time-format)
|
d/time-fmt (d/mk-fmt "us" d/short-time-format)
|
||||||
d/time-zone-offset (t/period :hours 0)]
|
d/time-zone-offset (t/period :hours 0)]
|
||||||
(is (= (d/to-short-str epoch-plus-3d) "12:00 AM"))))
|
(is (= (d/to-short-str epoch-plus-3d) "12:00 AM"))))
|
||||||
|
|
||||||
(deftest to-short-str-before-yesterday-us-test
|
(deftest to-short-str-before-yesterday-us-test
|
||||||
(with-redefs [t/*ms-fn* (constantly epoch-plus-3d)
|
(with-redefs [t/*ms-fn* (constantly epoch-plus-3d)
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
(is (= nil (eip681/parse-uri "ethereum:")))
|
(is (= nil (eip681/parse-uri "ethereum:")))
|
||||||
(is (= nil (eip681/parse-uri "ethereum:?value=1")))
|
(is (= nil (eip681/parse-uri "ethereum:?value=1")))
|
||||||
(is (= nil (eip681/parse-uri "bitcoin:0x1234")))
|
(is (= nil (eip681/parse-uri "bitcoin:0x1234")))
|
||||||
(is (= nil(eip681/parse-uri "ethereum:0x1234")))
|
(is (= nil (eip681/parse-uri "ethereum:0x1234")))
|
||||||
(is (= {:address "0x89205a3a3b2a69de6dbf7f01ed13b2108b2c43e7" :chain-id 1} (eip681/parse-uri "ethereum:0x89205a3a3b2a69de6dbf7f01ed13b2108b2c43e7")))
|
(is (= {:address "0x89205a3a3b2a69de6dbf7f01ed13b2108b2c43e7" :chain-id 1} (eip681/parse-uri "ethereum:0x89205a3a3b2a69de6dbf7f01ed13b2108b2c43e7")))
|
||||||
(is (= {:address "0x89205a3a3b2a69de6dbf7f01ed13b2108b2c43e7" :value "1" :chain-id 1} (eip681/parse-uri "ethereum:0x89205a3a3b2a69de6dbf7f01ed13b2108b2c43e7?value=1")))
|
(is (= {:address "0x89205a3a3b2a69de6dbf7f01ed13b2108b2c43e7" :value "1" :chain-id 1} (eip681/parse-uri "ethereum:0x89205a3a3b2a69de6dbf7f01ed13b2108b2c43e7?value=1")))
|
||||||
(is (= {:address "0x89205a3a3b2a69de6dbf7f01ed13b2108b2c43e7", :chain-id 1} (eip681/parse-uri "ethereum:0x89205a3a3b2a69de6dbf7f01ed13b2108b2c43e7?unknown=1")))
|
(is (= {:address "0x89205a3a3b2a69de6dbf7f01ed13b2108b2c43e7", :chain-id 1} (eip681/parse-uri "ethereum:0x89205a3a3b2a69de6dbf7f01ed13b2108b2c43e7?unknown=1")))
|
||||||
|
@ -61,7 +61,6 @@
|
||||||
{:keys [address] :as params} (eip681/parse-uri uri)]
|
{:keys [address] :as params} (eip681/parse-uri uri)]
|
||||||
(is (= uri (eip681/generate-uri address (dissoc params :address))))))
|
(is (= uri (eip681/generate-uri address (dissoc params :address))))))
|
||||||
|
|
||||||
|
|
||||||
(deftest parse-eth-value
|
(deftest parse-eth-value
|
||||||
(is (= nil (eip681/parse-eth-value nil)))
|
(is (= nil (eip681/parse-eth-value nil)))
|
||||||
(is (= nil (eip681/parse-eth-value 1)))
|
(is (= nil (eip681/parse-eth-value 1)))
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
(true? first-parameter))}
|
(true? first-parameter))}
|
||||||
{:trigger [:key3 :p1 :p2 :p3]}]))
|
{:trigger [:key3 :p1 :p2 :p3]}]))
|
||||||
|
|
||||||
|
|
||||||
(deftest matching-event
|
(deftest matching-event
|
||||||
(is (empty? (mixpanel/matching-events {} [:non-existing] definitions)))
|
(is (empty? (mixpanel/matching-events {} [:non-existing] definitions)))
|
||||||
(is (= 1 (count (mixpanel/matching-events {} [:key] definitions))))
|
(is (= 1 (count (mixpanel/matching-events {} [:key] definitions))))
|
||||||
|
@ -26,9 +25,9 @@
|
||||||
(deftest drain-events-queue!-test
|
(deftest drain-events-queue!-test
|
||||||
(async
|
(async
|
||||||
done
|
done
|
||||||
(let [queue (async/chan (async/sliding-buffer 2000))
|
(let [queue (async/chan (async/sliding-buffer 2000))
|
||||||
results (atom [])]
|
results (atom [])]
|
||||||
(async/go
|
(async/go
|
||||||
(async/<! (async/onto-chan queue (range 123) false))
|
(async/<! (async/onto-chan queue (range 123) false))
|
||||||
(async/<!
|
(async/<!
|
||||||
(mixpanel/drain-events-queue!
|
(mixpanel/drain-events-queue!
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
({:timestamp "1505764322000"}
|
({:timestamp "1505764322000"}
|
||||||
{:timestamp "1505750000000"})}))
|
{:timestamp "1505750000000"})}))
|
||||||
|
|
||||||
|
|
||||||
(deftest group-transactions-by-date
|
(deftest group-transactions-by-date
|
||||||
"Check if transactions are sorted by date"
|
"Check if transactions are sorted by date"
|
||||||
(is (= (transactions-subs/group-transactions-by-date transactions)
|
(is (= (transactions-subs/group-transactions-by-date transactions)
|
||||||
|
|
Loading…
Reference in New Issue