Fork me on GitHub
#helix
<
2020-06-18
>
jaime20:06:14

Hi, I'm currently evaluating react-testing-library to test helix components. I wonder what testing framework/lib do you use?

lilactown20:06:36

We use react-testing-library at work with helix

lilactown20:06:44

I would recommend it

👍 6
jaime19:06:41

Cool. Enjoying it so far 🙂

jaime19:06:43

Do you wrap the RTL functions like below? Or just using RTL directly on every test namespaces

(ns limeray.web.simulate
  (:require
   ["@testing-library/react" :as rtl :refer [fireEvent]]
   [cljs-bean.core :refer [->js]]))

(defn change [element event] (.change fireEvent element (->js event)))
(defn click [element] (.click fireEvent element))

lilactown19:06:23

i prefer to use rtl directly

lilactown19:06:54

creating a wrapper ends up just being a bunch of extra, undocumented code that I need to maintain

jaime20:06:54

I agree. I'm also thinking to just go all in 🙂