Yeah check track! then. https://github.com/reagent-project/reagent/blob/master/doc/ManagingState.md
Hey! Could someone help me with this error?
expected: (= "2020" (->> (r/as-element [footer-component]) (rtl/render) (.getByText "copyright") (.-innerHTML)))
actual: #object[ReferenceError ReferenceError: document is not defined]
I am trying to test drive my component, and here is the component def:
(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))))))
What might be the issue? Do I need to call some function to init the document?This? https://github.com/testing-library/react-testing-library/issues/422
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.
Checking ...
changed :target :node-test
to :target browser-test
. Got it working, thanks a bunch @p-himik