A MockAdapter that avoids real HTTP calls in unit tests.
Pattern: record captures the canned responses you want to return,
plus a calls atom that logs every request for assertion.
A MockAdapter that avoids real HTTP calls in unit tests. Pattern: record captures the canned responses you want to return, plus a `calls` atom that logs every request for assertion.
(all-calls adapter)Returns all recorded request maps.
Returns all recorded request maps.
(call-count adapter)Returns how many requests were made.
Returns how many requests were made.
(last-call adapter)Returns the most recent request map recorded by the adapter.
Returns the most recent request map recorded by the adapter.
(make-mock-adapter responses)Creates a MockAdapter that returns responses in round-robin order.
Example: (make-mock-adapter [{:status 200 :body {:id "abc123"}}])
Creates a MockAdapter that returns `responses` in round-robin order.
Example:
(make-mock-adapter [{:status 200 :body {:id "abc123"}}])cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |