Module

Elmish.Test.Bootstrap

Package
purescript-elmish-testing-library
Repository
collegevine/purescript-elmish-testing-library

#testComponent Source

testComponent :: forall m a msg state. MonadAff m => ComponentDef msg state -> ReaderT TestState m a -> m a

Mount the given component to a DOM element, run the given computation in the context of that element, return the computation's result.

Example:

describe "My component" $
  it "should work" $
    testComponent { init, view, update } do
      find "h1" >> text >>= shouldEqual "Hello"

#testElement Source

testElement :: forall m a. MonadAff m => ReactElement -> ReaderT TestState m a -> m a

A convenience version of testComponent for "pure" components - i.e. components that consist only of view, no init or update.