|
|
@@ -198,8 +198,9 @@
|
|
|
(is (= origin-graph-block-set (get-db-block-set @conn)))))))
|
|
|
|
|
|
(defn- print-page-stat
|
|
|
- [db page-uuid page-name]
|
|
|
- (let [blocks (ldb/get-page-blocks db page-name {})]
|
|
|
+ [db page-uuid]
|
|
|
+ (let [page (d/entity db [:block/uuid page-uuid])
|
|
|
+ blocks (ldb/get-page-blocks db (:db/id page) {})]
|
|
|
(pp/pprint
|
|
|
{:block-count (count blocks)
|
|
|
:undo-op-count (count (get-in @(:undo/repo->page-block-uuid->undo-ops @worker-state/*state)
|
|
|
@@ -208,8 +209,9 @@
|
|
|
[test-helper/test-db-name-db-version page-uuid]))})))
|
|
|
|
|
|
(defn- print-page-blocks-tree
|
|
|
- [db page-uuid page-name]
|
|
|
- (let [blocks (ldb/get-page-blocks db page-name {})]
|
|
|
+ [db page-uuid]
|
|
|
+ (let [page (d/entity db [:block/uuid page-uuid])
|
|
|
+ blocks (ldb/get-page-blocks db (:db/id page) {})]
|
|
|
(prn ::page-block-tree)
|
|
|
(pp/pprint
|
|
|
(walk/postwalk
|
|
|
@@ -222,7 +224,7 @@
|
|
|
(otree/blocks->vec-tree test-helper/test-db-name-db-version db
|
|
|
blocks page-uuid)))))
|
|
|
|
|
|
-(deftest undo-redo-outliner-op-gen-test
|
|
|
+(deftest ^:wip undo-redo-outliner-op-gen-test
|
|
|
(try
|
|
|
(let [conn (db/get-db false)]
|
|
|
(loop [num 100]
|
|
|
@@ -233,11 +235,11 @@
|
|
|
(recur (dec num)))
|
|
|
(recur (dec num)))))
|
|
|
(println "================ random inserts ================")
|
|
|
- (print-page-stat @conn page-uuid "test")
|
|
|
+ (print-page-stat @conn page-uuid)
|
|
|
(undo-all conn page-uuid)
|
|
|
- (print-page-stat @conn page-uuid "test")
|
|
|
+ (print-page-stat @conn page-uuid)
|
|
|
(redo-all conn page-uuid)
|
|
|
- (print-page-stat @conn page-uuid "test")
|
|
|
+ (print-page-stat @conn page-uuid)
|
|
|
|
|
|
(loop [num 1000]
|
|
|
(when (> num 0)
|
|
|
@@ -247,11 +249,11 @@
|
|
|
(recur (dec num)))
|
|
|
(recur (dec num)))))
|
|
|
(println "================ random moves ================")
|
|
|
- (print-page-stat @conn page-uuid "test")
|
|
|
+ (print-page-stat @conn page-uuid)
|
|
|
(undo-all conn page-uuid)
|
|
|
- (print-page-stat @conn page-uuid "test")
|
|
|
+ (print-page-stat @conn page-uuid)
|
|
|
(redo-all conn page-uuid)
|
|
|
- (print-page-stat @conn page-uuid "test")
|
|
|
+ (print-page-stat @conn page-uuid)
|
|
|
|
|
|
(loop [num 100]
|
|
|
(when (> num 0)
|
|
|
@@ -261,18 +263,18 @@
|
|
|
(recur (dec num)))
|
|
|
(recur (dec num)))))
|
|
|
(println "================ random deletes ================")
|
|
|
- (print-page-stat @conn page-uuid "test")
|
|
|
+ (print-page-stat @conn page-uuid)
|
|
|
(undo-all conn page-uuid)
|
|
|
- (print-page-stat @conn page-uuid "test")
|
|
|
+ (print-page-stat @conn page-uuid)
|
|
|
(try (redo-all conn page-uuid)
|
|
|
(catch :default e
|
|
|
- (print-page-blocks-tree @conn page-uuid "test")
|
|
|
+ (print-page-blocks-tree @conn page-uuid)
|
|
|
(throw e)))
|
|
|
- (print-page-stat @conn page-uuid "test"))
|
|
|
+ (print-page-stat @conn page-uuid))
|
|
|
(catch :default e
|
|
|
(let [data (ex-data e)]
|
|
|
(fs-node/writeFileSync "debug.json" (sqlite-util/write-transit-str data))
|
|
|
- (throw (ex-info "stop now" {}))))))
|
|
|
+ (throw e)))))
|
|
|
|
|
|
|
|
|
|