Fork me on GitHub

Hi, what do you use to mock/spy function calls during testing? I have the below test, and notice the on-change which is kind of a mock with assertion that the value it receives is equal to some value. I think the intent or the assertion there is not very clear to the reader. IMO, assertions should come at the end of the test

(deftest text-field
  (testing "calls on-change with new value"
    (let [new-value "jaime"
          on-change #(is (= % new-value))] ;; I feel like the assertion inside the on-change is not very clear for the reader
        [ui/text-field {:id "text-input" :on-change on-change :label "foo"}]
        (fn [{:keys [getByTestId]}]
          (.change rtl/fireEvent (getByTestId "text-input") (clj->js {:target {:value new-value}}))
          ;; I think its better to have assertion here like (is-mock-called-with? on-change "jaime")))))
I'm thinking to try this one , do you have other recommendations that I can try later?