(combine-emulators emu1 & more)
Combine two or more effect emualtors into one, to be used with env
.
Combine two or more effect emualtors into one, to be used with [[env]].
(env item & [options])
Returns a new test environment to test the behavior of the given item. Options map may include
:emulator a function (fn [env effect] (return ...)) that may handle effect action reaching the toplevel.
Returns a new test environment to test the behavior of the given item. Options map may include :emulator a function (fn [env effect] (return ...)) that may handle effect action reaching the toplevel.
(execute-effect! env eff)
Executed the given effect in the given test environment.
Executed the given effect in the given test environment.
(mount! env state)
Mounts the item of the given test environment with the given state, and returns actions and maybe a changed state.
Mounts the item of the given test environment with the given state, and returns actions and maybe a changed state.
(preventing-error-log thunk)
Prevents a log message about an exception during the evaluation of
thunk
, which occurs event when the error is handled in an error
boundary.
Prevents a log message about an exception during the evaluation of `thunk`, which occurs event when the error is handled in an error boundary.
(send-message! comp msg)
Sends a message to the given component or the toplevel component of the given test environment, and returns actions and maybe a changed state.
Sends a message to the given component or the toplevel component of the given test environment, and returns actions and maybe a changed state.
(subscribe-effect-args eff)
The arguments passed to the subscription the given subscribe effect was generated from.
The arguments passed to the subscription the given subscribe effect was generated from.
(subscribe-effect? eff)
(subscribe-effect? eff subs)
Tests if the given effect, is one that is emitted by a subscription equal to the given one on mount. This can be useful in unit tests.
Tests if the given effect, is one that is emitted by a subscription equal to the given one on mount. This can be useful in unit tests.
(subscription-emulator subs-env)
Returns the emulator function to be set as the :emulator option of a testing environemnt.
Returns the emulator function to be set as the :emulator option of a testing environemnt.
(subscription-emulator-env sub)
Create a subscription emulation environment for items like the given subscription.
Create a subscription emulation environment for items like the given subscription.
(subscription-emulator-inject! subs-env action)
Make the emulated subscription emit the given action.
Make the emulated subscription emit the given action.
(subscription-emulator-running? subs-env)
Checks if the subscription emulation environment is attached as the :emulator to a testing environment and a subscription is mounted.
Checks if the subscription emulation environment is attached as the :emulator to a testing environment and a subscription is mounted.
(subscription-result! env sub-eff action)
For the effect that resulted from mounting a
subscription (see subscribe-effect?
), inject the given action as
a result of the subscription item, and return what the tested
component in the given test environment returns.
For the effect that resulted from mounting a subscription (see [[subscribe-effect?]]), inject the given action as a result of the subscription item, and return what the tested component in the given test environment returns.
(subscription-start! env sub-eff & [stop-fn!])
Begins a simulated execution of the subscription given by the given
effect that resulting from mounting
it (see subscribe-effect?
). The optional given stop-fn!
will
be called when the unsubscribe-effect?
returned on unmount is
executed.
Begins a simulated execution of the subscription given by the given effect that resulting from mounting it (see [[subscribe-effect?]]). The optional given `stop-fn!` will be called when the [[unsubscribe-effect?]] returned on unmount is executed.
(unmount! env)
Unmounts the item of the given test environment, and return actions and maybe a changed state.
Unmounts the item of the given test environment, and return actions and maybe a changed state.
(unsubscribe-effect-args eff)
The arguments passed to the subscription the given unsubscribe effect was generated from.
The arguments passed to the subscription the given unsubscribe effect was generated from.
(unsubscribe-effect? eff)
(unsubscribe-effect? eff subs)
Tests if the given effect, is one that is emitted by a subscription equal to the given one, on unmount. This can be useful in unit tests.
Tests if the given effect, is one that is emitted by a subscription equal to the given one, on unmount. This can be useful in unit tests.
(update! env state)
Updates the state of the item of the given test environment, and returns actions and maybe a changed state.
Updates the state of the item of the given test environment, and returns actions and maybe a changed state.
(update!! env state)
Updates the state of the item of the given test environment, and if the state is changed in reaction to that, then keeps on updating it. Returns actions and the final changed state, if it was changed at all. Throws if there are more than max-update-loops recursions, which are a sign for bug in the item.
Updates the state of the item of the given test environment, and if the state is changed in reaction to that, then keeps on updating it. Returns actions and the final changed state, if it was changed at all. Throws if there are more than *max-update-loops* recursions, which are a sign for bug in the item.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close