lundi 17 octobre 2016

Use functions that return "Handler Text" in yesod-tests

Here's a (simplified) test I have

it "asserts route access for valid arguments" $ do
    -- ... 
    token <- getFlagTokenFromCsrf "1234"

    get $ FlagMentorR flaggedId Flag token
    statusIs 200

where I have getFlagTokenFromCsrf :: Text -> Handler Text

The error I get when I try to stack test is:

Couldn't match type ‘Yesod.Core.Types.HandlerT App IO Text’
               with ‘Control.Monad.Trans.State.Lazy.StateT
                       (YesodExampleData App) IO Text’
Expected type: Control.Monad.Trans.State.Lazy.StateT
                 (YesodExampleData App) IO Text
  Actual type: Handler Text

Aucun commentaire:

Enregistrer un commentaire