rcmerci преди 1 година
родител
ревизия
d85dacc5c6
променени са 4 файла, в които са добавени 5 реда и са изтрити 50 реда
  1. 1 1
      .carve/config.edn
  2. 4 1
      src/main/frontend/worker/rtc/log_and_state.cljs
  3. 0 44
      src/rtc_e2e_test/helper.clj
  4. 0 4
      src/rtc_e2e_test/helper.cljs

+ 1 - 1
.carve/config.edn

@@ -1,6 +1,6 @@
 {;; Only lint production namespaces as most dev
  ;; namespaces are unused
- :paths ["src/main" "src/electron" "src/test"]
+ :paths ["src/main" "src/electron" "src/test" "src/rtc_e2e_test"]
  :api-namespaces [;; Ignore b/c too many false positives
                   frontend.db
                   ;; Used for debugging

+ 4 - 1
src/main/frontend/worker/rtc/log_and_state.cljs

@@ -6,7 +6,10 @@
             [missionary.core :as m]))
 
 (def ^:private *rtc-log (atom nil))
-(def rtc-log-flow (m/watch *rtc-log))
+
+(def rtc-log-flow
+  "used by rtc-e2e-test"
+  (m/watch *rtc-log))
 
 (sr/defkeyword :rtc.log/upload
   "rtc log type for upload-graph.")

+ 0 - 44
src/rtc_e2e_test/helper.clj

@@ -1,44 +0,0 @@
-(ns helper)
-
-;; Copied from https://clojurians.slack.com/archives/C03S1L9DN/p1631221014001900?thread_ts=1631219838.001500&cid=C03S1L9DN
-(defmacro with-reset
-  "Like cljs.core/with-redefs, but bindings persist until the `reset` fn is
- called, allowing bindings to be used in async contexts."
-  [reset bindings & body]
-  ;; code adapted from https://cljs.github.io/api/cljs.core/with-redefs
-  (let [names (take-nth 2 bindings)
-        vals (take-nth 2 (drop 1 bindings))
-        orig-val-syms (map (comp gensym #(str % "-orig-val__") name) names)
-        temp-val-syms (map (comp gensym #(str % "-temp-val__") name) names)
-        binds (map vector names temp-val-syms)
-        redefs (reverse (map vector names orig-val-syms))
-        bind-value (fn [[k v]] (list 'set! k v))]
-    `(let [~@(interleave orig-val-syms names)
-           ~@(interleave temp-val-syms vals)
-           ~reset #(do ~@(map bind-value redefs))]
-       ~@(map bind-value binds)
-       ~@body)))
-
-;; Copied from https://github.com/babashka/nbb/blob/e5d84b0fac59774f5d7a4a9e807240cce04bf252/test/nbb/test_macros.clj
-(defmacro deftest-async
-  "A wrapper around deftest that handles async and done in all cases.
-  Importantly, it prevents unexpected failures in an async test from abruptly
-  ending a test suite"
-  [name opts & body]
-  (let [[opts body]
-        (if (map? opts)
-          [opts body]
-          [nil (cons opts body)])]
-    `(cljs.test/deftest ~name
-       ~@(when-let [pre (:before opts)]
-           [pre])
-       (cljs.test/async
-        ~'done
-        (-> (do ~@body)
-            (.catch (fn [err#]
-                      (cljs.test/is (= 1 0) (str err# (.-stack err#)))))
-            (.finally
-             (fn []
-               ~@(when-let [post (:after opts)]
-                   [post])
-               (~'done))))))))

+ 0 - 4
src/rtc_e2e_test/helper.cljs

@@ -68,10 +68,6 @@
   []
   (worker-state/get-datascript-conn const/downloaded-test-repo))
 
-(defn get-example-test-conn
-  []
-  (worker-state/get-datascript-conn const/test-repo))
-
 (defn simplify-client-op
   [client-op]
   #_:clj-kondo/ignore