Mock monadic programs
Mock monadic programs
(is-mocked-state expectation mock-result-state)Takes an expectation and the monad-command-config-state after running a mock.
Applies is to the = of both, dissocing the ::mocks from the returned state.
Takes an `expectation` and the `monad-command-config-state` after running a mock. Applies `is` to the `=` of both, dissocing the ::mocks from the returned state.
(mock check! get-result)Construct a Mock record.
check!: access via active.clojure.mock-monad/mock-check!
get-result: access via active.clojure.mock-monad/mock-get-result
Construct a `Mock` record. `check!`: access via [[active.clojure.mock-monad/mock-check!]] `get-result`: access via [[active.clojure.mock-monad/mock-get-result]]
(mock-check! rec__2619__auto__)(mock-check! data__2620__auto__ v__2621__auto__)(mock-check! rec__2304__auto__)(mock-check! data__2305__auto__ v__2306__auto__)Lens for the check! field from a Mock record. See active.clojure.mock-monad/mock.
Lens for the `check!` field from a [[Mock]] record. See [[active.clojure.mock-monad/mock]].
(mock-effect m-expected m-replacement)If (= m-expected m) returns true for a command m, then execute m-replacement instead.
If `(= m-expected m)` returns true for a command `m`, then execute `m-replacement` instead.
(mock-execute-monad mocks m)(mock-execute-monad command-config mocks m)(mock-get-result rec__2619__auto__)(mock-get-result data__2620__auto__ v__2621__auto__)(mock-get-result rec__2304__auto__)(mock-get-result data__2305__auto__ v__2306__auto__)Lens for the get-result field from a Mock record. See active.clojure.mock-monad/mock.
Lens for the `get-result` field from a [[Mock]] record. See [[active.clojure.mock-monad/mock]].
(mock-result m-expected value)If (= m-expected m) returns true for a command m, then return value instead.
If `(= m-expected m)` returns true for a command `m`, then return `value` instead.
(mock-run-monad mocks m)(mock-run-monad command-config mocks m)Run m under the given monad command configs, and the given mocked commands, returning the result of m.
mocks should be a sequence, whose values can be created by the
mock, mock-result or mock-effect and other functions above, and are
expected to appear in that order while executing m.
Run m under the given monad command configs, and the given mocked commands, returning the result of m. `mocks` should be a sequence, whose values can be created by the `mock`, `mock-result` or `mock-effect` and other functions above, and are expected to appear in that order while executing `m`.
(mock? thing)Is object a Mock record? See active.clojure.mock-monad/mock.
Is object a `Mock` record? See [[active.clojure.mock-monad/mock]].
(with-mock-run-monad command-config f)Immediately calls f with a function of two arguments, mocks and
m, which can be repeatedly called to evaluate monadic commands
m, with mocked commands like in test-run-monad. The monad state
is preserved from call to call. Returns [result state].
Immediately calls f with a function of two arguments, `mocks` and `m`, which can be repeatedly called to evaluate monadic commands `m`, with mocked commands like in `test-run-monad`. The monad state is preserved from call to call. Returns `[result state]`.
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 |