diff --git a/src/test/frontend/worker/db_worker_test.cljs b/src/test/frontend/worker/db_worker_test.cljs index 0fc2508108..61137a0f80 100644 --- a/src/test/frontend/worker/db_worker_test.cljs +++ b/src/test/frontend/worker/db_worker_test.cljs @@ -1,21 +1,20 @@ (ns frontend.worker.db-worker-test - (:require [cljs.test :refer [async deftest is]] - [clojure.string :as string] - [datascript.core :as d] - [frontend.common.thread-api :as thread-api] - [frontend.worker.a-test-env] - [frontend.worker.db-worker :as db-worker] - [frontend.worker.db.validate :as worker-db-validate] - [frontend.worker.search :as search] - [frontend.worker.shared-service :as shared-service] - [frontend.worker.state :as worker-state] - [frontend.worker.sync :as db-sync] - [frontend.worker.sync.client-op :as client-op] - [frontend.worker.sync.crypt :as sync-crypt] - [frontend.worker.sync.log-and-state :as rtc-log-and-state] - [logseq.db.frontend.schema :as db-schema] - [logseq.db.frontend.validate :as db-validate] - [promesa.core :as p])) + (:require + [cljs.test :refer [async deftest is]] + [datascript.core :as d] + [frontend.common.thread-api :as thread-api] + [frontend.worker.a-test-env] + [frontend.worker.db-worker :as db-worker] + [frontend.worker.db.validate :as worker-db-validate] + [frontend.worker.search :as search] + [frontend.worker.shared-service :as shared-service] + [frontend.worker.state :as worker-state] + [frontend.worker.sync :as db-sync] + [frontend.worker.sync.client-op :as client-op] + [frontend.worker.sync.crypt :as sync-crypt] + [frontend.worker.sync.log-and-state :as rtc-log-and-state] + [logseq.db.frontend.schema :as db-schema] + [promesa.core :as p])) (def ^:private test-repo "test-db-worker-repo") (def ^:private close-db!-orig db-worker/close-db!) @@ -359,28 +358,3 @@ @captured))) (finally (reset! db-sync/*repo->latest-remote-tx latest-prev))))))) - -(deftest validate-db-notification-includes-sync-diagnostics-test - (let [conn (d/create-conn db-schema/schema) - notifications (atom []) - sync-diagnostics {:local-tx 3 - :remote-tx 5 - :local-checksum "local-checksum" - :remote-checksum "remote-checksum"}] - (with-redefs [db-validate/validate-db! (fn [_db] {:errors nil - :datom-count 0 - :entities []}) - db-validate/graph-counts (fn [_db _entities] {}) - shared-service/broadcast-to-clients! (fn [topic payload] - (swap! notifications conj [topic payload]))] - (worker-db-validate/validate-db test-repo conn sync-diagnostics) - (let [[topic payload] (first (filter (fn [[topic* _]] - (= :notification topic*)) - @notifications)) - [message status] payload] - (is (= :notification topic)) - (is (= :success status)) - (is (string/includes? message ":local-checksum \"local-checksum\"")) - (is (string/includes? message ":remote-checksum \"remote-checksum\"")) - (is (string/includes? message ":local-tx 3")) - (is (string/includes? message ":remote-tx 5"))))))