Clojurescript functions for mocking, based on examples from 'Clojure in action'. Functions to be mocked must be declared dynamic.
Clojurescript functions for mocking, based on examples from 'Clojure in action'. Functions to be mocked must be declared dynamic.
(calls f)
(fail)
(fail message)
(last-call f)
Return the arguments to the most recent call to f
, or nil if there was no call. f
must be a mock.
Return the arguments to the most recent call to `f`, or nil if there was no call. `f` must be a mock.
(mock f)
Constuct a mock that will capture arguments and return the result of applying f
to the arguments.
Constuct a mock that will capture arguments and return the result of applying `f` to the arguments.
(not-called f)
Return true iff f
was not called. f
must be a mock.
Return true iff `f` was not called. `f` must be a mock.
(only-call f)
Return the arguments to the only call to f
, or nil if there was not exactly one call to f
. f
must be a mock.
Return the arguments to the only call to `f`, or nil if there was not exactly one call to `f`. `f` must be a mock.
(stub v)
Construct a mock that will capture arguments while always returning v
.
Construct a mock that will capture arguments while always returning `v`.
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 |