Simulated effects for testing. These parallel Elm's Cmd type
but are inspectable by the test framework.
Use these with Effect.testPerform to decompose
your Effect type into something the test framework can process.
import Test.PagesProgram.SimulatedEffect as SimulatedEffect
-- In your Effect module:
testPerform : Effect msg -> SimulatedEffect msg
testPerform effect =
case effect of
None ->
SimulatedEffect.none
Cmd _ ->
-- Opaque Cmds cannot be simulated. Use simulateMsg
-- in your test to inject the message manually.
SimulatedEffect.none
Batch list ->
SimulatedEffect.batch (List.map testPerform list)
SendMsg msg ->
SimulatedEffect.dispatchMsg msgNo effect. Parallels Effect.none.
Also use this for opaque Cmd values that cannot be simulated.
Use simulateMsg in your test to
inject the message that the Cmd would have produced.
Combine multiple simulated effects. Parallels Effect.batch.
Dispatch a message through the program's update cycle. This is the
test-simulatable equivalent of Effect.sendMsg.
testPerform effect =
case effect of
SendMsg msg ->
SimulatedEffect.dispatchMsg msgSet a form field value. Parallels Effect.setField.
Submit a fetcher for concurrent form submission. Parallels Effect.submitFetcher.
Transform the messages produced by a simulated effect.
A simulated effect that the test framework can inspect and execute.
None-- no effectBatch-- multiple effectsDispatchMsg msg-- dispatch a message through the update cycleSetField-- set a form field valueSubmitFetcher-- submit a fetcher (concurrent form submission)