Fork me on GitHub
#ring
<
2022-08-17
>
Jérémie Salvucci14:08:37

Hi, I'm using http-kit with ring and reitit to make an api and I'd like to test my main handler. I've seen that clojure.test + ring-mock was a thing to do unit testing. Is there anything else to perform this?

Ferdinand Beyer12:08:40

Why are you looking for something else? It is hard to answer. There are alternatives to clojure.test such as midje, but it is not clear what exactly you want to know? In theory a ring handler is just an ordinary function, so you don’t need special tooling to test it. ring-mock definitely helps as it is a bit tedious to generate request maps your self.

Jérémie Salvucci09:08:58

Oh, I just wanted to know if the following way of doing things was reasonable given the current state of the Clojure ecosystem (ring and http-kit related)

Jérémie Salvucci09:08:19

Yes, generating requests is a bit tedious, so this ring-mock is useful, but maybe there is some other nice tools I'm not aware of related to handler testing, etc.