testing

Testing tools, testing philosophy & methodology...
2021-05-23T05:45:51.001200Z

Is there a solution out there for testing intermediate values in a threading macro? I.e. I want to write something like:

(-> [{:id 1}]
    (click 1)
    (is {:id 1 :selected? true})
    (click 1)
    (is {:id 1 :selected? false}))

vemv 2021-05-23T12:47:51.002Z

doto?

plexus 2021-05-25T06:48:40.002300Z

doto won't really work because of the nesting, but just create your own helpers

(let [assert-selected #(do (is (= %1 {:id 1 :selected? %2})) %1)]
  (-> [{:id 1}]
    (click 1)
    (assert-selected true)
    (click 1)
    (assert-selected false)))