Questions tagged [yesod-test]

7 questions
1
vote
1 answer

How is ydescribe from Yesod.Test used?

I am trying to write tests where one test signs in and then the following tests use the cookie set from the first sign in test. From what I can see, this is done with ydescribe Start describing a Tests suite keeping cookies and a reference to the…
Qwertie
  • 5,784
  • 12
  • 45
  • 89
1
vote
1 answer

Assert json matches using Yesod.Test

I wan't to get a resource from my yesod app and assert it matches a known JSON value. I can see that in Yesod.Test.Json there is the function assertJSON with the type assertJSON :: (ToJSON a, FromJSON a) => (a -> (String, Bool)) -> SResponse ->…
Qwertie
  • 5,784
  • 12
  • 45
  • 89
0
votes
1 answer

Haskell: Using in-memory sqlite db in Yesod Tests?

I'm trying to make my first Yesod website, and was now adding tests. I'm setting up like this: shortblitoWebServerSpec :: ShortblitoWebServerSpec -> Spec shortblitoWebServerSpec = yesodSpecWithSiteGenerator $ runNoLoggingT $ …
The Oddler
  • 6,314
  • 7
  • 51
  • 94
0
votes
1 answer

How to use Hspec/Yesod.Test with Sqlite?

I have a basic Yesod server that uses an Sqlite db, and I'm trying to add tests to it. I'm very new to Haskell, so I'm even struggling to find the right terminology, so bare with me. I have this code to run the server: runShortblitoWebServer ::…
The Oddler
  • 6,314
  • 7
  • 51
  • 94
0
votes
2 answers

Run db action in yesod test

In my yesod test I want to be able to modify a record in the db in the middle of the test. Here is the code I came up with yit "post is created by authorized user" $ do request $ do addPostParam "ident" "dummy" …
Qwertie
  • 5,784
  • 12
  • 45
  • 89
0
votes
1 answer

Couldn't match expected type ‘Post’ with actual type ‘Route App’

I'm trying to use the function postBody postBody :: (Yesod site, RedirectUrl site url) => url -> ByteString -> YesodExample site () from the Yesod.Test package. The documentation says it can be used like this import Data.Aeson postBody HomeR…
Qwertie
  • 5,784
  • 12
  • 45
  • 89
0
votes
0 answers

In Yesod.Test, is it possible to get into `SpecM (TestApp site)` from `IO`, similarly to how `liftIO` allows the opposite?

More specifically, I'm looking for a function of type: f :: site -> SpecM (TestApp site) b -> IO b or similar. In other words, I am looking for the inverse function of: liftIO :: IO b -> SpecM (TestApp _site) b I've looked in the Yesod.Test docs…
Wizek
  • 4,854
  • 2
  • 25
  • 52