From 761d4b80e497f85b2e5d615ac554d2c49238b411 Mon Sep 17 00:00:00 2001 From: Juho Teperi Date: Sat, 23 Nov 2024 13:42:17 +0200 Subject: [PATCH] Cleanup unused test utils --- test/reagenttest/utils.cljs | 57 +------------------------------------ 1 file changed, 1 insertion(+), 56 deletions(-) diff --git a/test/reagenttest/utils.cljs b/test/reagenttest/utils.cljs index b09dc190..356aa7d9 100644 --- a/test/reagenttest/utils.cljs +++ b/test/reagenttest/utils.cljs @@ -1,9 +1,8 @@ (ns reagenttest.utils (:require-macros reagenttest.utils) (:require [promesa.core :as p] - [react :as react] [reagent.core :as r] - [reagent.debug :as debug :refer [dev?]] + [reagent.debug :as debug] [reagent.dom :as rdom] [reagent.dom.server :as server] [reagent.impl.template :as tmpl])) @@ -36,39 +35,6 @@ (defn as-string [comp] (server/render-to-static-markup comp *test-compiler*)) -(defn with-mounted-component - ([comp f] - (with-mounted-component comp *test-compiler* f)) - ([comp compiler f] - (let [div (.createElement js/document "div")] - (try - (let [c (if compiler - (rdom/render comp div compiler) - (rdom/render comp div))] - (f c div)) - (finally - (rdom/unmount-component-at-node div) - (r/flush)))))) - -(defn with-mounted-component-async - [comp done compiler f] - (let [div (.createElement js/document "div") - c (if compiler - (rdom/render comp div compiler) - (rdom/render comp div))] - (f c div (fn [] - (rdom/unmount-component-at-node div) - (r/flush) - (done))))) - -(defn run-fns-after-render [& fs] - ((reduce (fn [cb f] - (fn [] - (r/after-render (fn [] - (f) - (cb))))) - (reverse fs)))) - ;; For testing logged errors and warnings (defn log-error [& f] @@ -85,27 +51,6 @@ (finally (set! js/console.error org)))))) -(defn wrap-capture-window-error [f] - (if (exists? js/window) - (fn [] - (let [org js/console.onerror] - (set! js/window.onerror (fn [e] - (log-error e) - true)) - (try - (f) - (finally - (set! js/window.onerror org))))) - (fn [] - (let [process (js/require "process") - l (fn [e] - (log-error e))] - (.on process "uncaughtException" l) - (try - (f) - (finally - (.removeListener process "uncaughtException" l))))))) - ;; Promise versions (defn wrap-capture-console-error-promise [f]