WAI testing + persistent - Haskell

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

Pavan Rikhi

Has anyone used the Network.Wai.Test module from wai-extra along with Persistent to test their handlers?

Pavan Rikhi

I'm trying to use it with tasty-wai: https://hackage.haskell.org/package/tasty-wai-0.1.1.0/docs/Test-Tasty-Wai.html
I opened a raw connection in my tests main, passed it to my API tests as well as the my app :: SqlBackend -> Application, and used a runDB function to run the SQL bits in my tests. It worked fine when I had a single test, but once I added another test with another sql block, it gave me an error:

Exception: SQLite3 returned ErrorError while attempting to perform step: cannot start a transaction within a transaction
Pavan Rikhi

Urg, just had to switch the test-suite to single-threaded...