Yeah check track! then. https://github.com/reagent-project/reagent/blob/master/doc/ManagingState.md
Hey! Could someone help me with this error?
I am trying to test drive my component, and here is the component def:
expected: (= "2020" (->> (r/as-element [footer-component]) (rtl/render) (.getByText "copyright") (.-innerHTML))) actual: #object[ReferenceError ReferenceError: document is not defined]
What might be the issue? Do I need to call some function to init the document?
(ns components.footer-test (:require [reagent.core :as r] ["@testing-library/react" :as rtl] [components.footer :refer [footer-component]] [cljs.test :refer [deftest testing is use-fixtures]])) (deftest test-that-copyright-has-correct-year (testing "Test Correct year in copyright" (is (= "2020" (-> (r/as-element [footer-component]) (rtl/render) (.getByText "copyright") (.-innerHTML))))))
Always look at the stacktrace. If it ends up in some JS library, then chances are that the problem is with the usage of that library and not with the CLJS code itself.
I know it is not a problem with CLJS ....
Well, either way that issue has a fix.