Fork me on GitHub
#testing
<
2023-10-19
>
tragiclifestories16:10:20

Just a question about test doubles - I'm wondering if there's a convenient library for creating mock functions. Googling around this seems to lead to a lot of options that focus on redefining vars, but that's what I'm trying to avoid. Basically I'm looking for jest.fn only in Clojure, which you could sort of use like:

(let [f (create-stub)]
  (do-thing! f)
  (is (= (call-count f) 1))
  (is (= (args-for-call f 0) [:foo :bar])))
Obviously this is the sort of thing that one can write oneself, but if it's already out there, I'd like to borrow it ...

Derek17:10:05

I'm fairly sure https://github.com/alexanderjamesking/spy can be used that way

1
tragiclifestories17:10:15

yeah, that looks handy. Thanks!

Daniel Miladinov21:10:04

I'd like announce https://github.com/danielmiladinov/burpless, a library I just released, for facilitating writing cucumber tests from Clojure