mirror of
https://github.com/logseq/logseq.git
synced 2026-02-01 22:47:36 +00:00
test(rtc): update basic-edits-test
This commit is contained in:
3
deps.edn
3
deps.edn
@@ -39,7 +39,8 @@
|
||||
logseq/shui {:local/root "deps/shui"}
|
||||
metosin/malli {:mvn/version "0.16.1"}
|
||||
com.cognitect/transit-cljs {:mvn/version "0.8.280"}
|
||||
missionary/missionary {:mvn/version "b.39"}}
|
||||
missionary/missionary {:mvn/version "b.39"}
|
||||
meander/epsilon {:mvn/version "0.0.650"}}
|
||||
|
||||
:aliases {:cljs {:extra-paths ["src/dev-cljs/" "src/test/" "src/electron/"]
|
||||
:extra-deps {org.clojure/clojurescript {:mvn/version "1.11.132"}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
(ns basic-edits-test
|
||||
(:require [cljs.test :as t :refer [deftest testing is]]
|
||||
[fixture]
|
||||
[helper]
|
||||
[frontend.worker.rtc.client-op :as client-op]
|
||||
(:require [cljs.test :as t :refer [deftest is testing]]
|
||||
[const]
|
||||
[datascript.core :as d]
|
||||
[logseq.db :as ldb]
|
||||
[logseq.outliner.batch-tx :as batch-tx]))
|
||||
[fixture]
|
||||
[frontend.worker.rtc.client-op :as client-op]
|
||||
[helper]
|
||||
[logseq.outliner.batch-tx :as batch-tx]
|
||||
[meander.epsilon :as me]))
|
||||
|
||||
(t/use-fixtures :once
|
||||
fixture/install-some-consts
|
||||
@@ -14,6 +14,17 @@
|
||||
fixture/clear-test-remote-graphs-fixture
|
||||
fixture/build-two-conns-by-download-example-graph-fixture)
|
||||
|
||||
(defn- simplify-client-op
|
||||
[client-op]
|
||||
#_:clj-kondo/ignore
|
||||
(me/find
|
||||
client-op
|
||||
[?op-type _t {:block-uuid ?block-uuid :av-coll [[!a !v _t !add] ...]}]
|
||||
[?op-type ?block-uuid (map vector !a !v !add)]
|
||||
|
||||
[?op-type _t {:block-uuid ?block-uuid}]
|
||||
[?op-type ?block-uuid]))
|
||||
|
||||
(deftest basic-edits-test
|
||||
(let [conn1 (helper/get-downloaded-test-conn)
|
||||
conn2 (helper/get-downloaded-test-conn2)
|
||||
@@ -37,9 +48,17 @@
|
||||
:block/page "page"}]]
|
||||
(batch-tx/with-batch-tx-mode conn1 {:e2e-test const/downloaded-test-repo}
|
||||
(d/transact! conn1 tx-data))
|
||||
|
||||
(is (=
|
||||
#{[:update page-uuid1] [:update-page page-uuid1] [:move block-uuid1] [:update block-uuid1]}
|
||||
(set (map (juxt first (comp :block-uuid last)) (client-op/get-all-ops const/downloaded-test-repo)))))
|
||||
(prn :all-ops
|
||||
(client-op/get-all-ops const/downloaded-test-repo)
|
||||
(client-op/get-local-tx const/downloaded-test-repo))))))
|
||||
#{[:update-page page-uuid1]
|
||||
[:update page-uuid1
|
||||
[[:block/title "[\"~#'\",\"basic-edits-test\"]" true]
|
||||
[:block/created-at "[\"~#'\",1724836490809]" true]
|
||||
[:block/updated-at "[\"~#'\",1724836490809]" true]
|
||||
[:block/type "[\"~#'\",\"page\"]" true]]]
|
||||
[:move block-uuid1]
|
||||
[:update block-uuid1
|
||||
[[:block/updated-at "[\"~#'\",1724836490810]" true]
|
||||
[:block/created-at "[\"~#'\",1724836490810]" true]
|
||||
[:block/title "[\"~#'\",\"block1\"]" true]]]}
|
||||
(set (map simplify-client-op (client-op/get-all-ops const/downloaded-test-repo)))))))))
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
graph (some (fn [graph] (when (= graph-uuid (:graph-uuid graph)) graph)) graphs)]
|
||||
(when-not graph
|
||||
(throw (ex-info "graph not exist" {:graph-uuid graph-uuid})))
|
||||
(prn "waiting for graph " graph-uuid " finish creating")
|
||||
(println "waiting for graph " graph-uuid " finish creating")
|
||||
(when (= "creating" (:graph-status graph))
|
||||
(throw (ex-info "wait creating-graph" {:missionary/retry true})))))))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user