I'm using hspec-snap 
to write unit tests for my snap application. I'm running into problems with 
routes. It's very possible that I'm overlooking something simple, many 
thanks for your help! My app looks roughly as follows:

app :: SnapletInit App App
app = do
  a <- nestSnaplet "api" api $ apiInit 
  addRoutes routes
  return $ App a

routes = [("login", handleLogin), ..]

The api snaplet has additional routes (using servant, but I don't think 
that should matter here). I can set up unit testing as follows:

tests = Test.snap (route routes) app $ do
  .. running tests here ..

But the problem is that, when I run these tests, only the routes that are 
specified as part of `routes` are reachable. I find this confusing. First 
of all, why are routes required? The `app` snaplet already adds routes. The 
bigger problem is that I can't reach the routes that are part of the nested 
`api` snaplet, so I don't have a way of testing that functionality.

Thanks, Chris


You received this message because you are subscribed to the Google Groups "Snap 
Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to snap_framework+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to