1
1
mirror of https://github.com/qfpl/applied-fp-course.git synced 2024-11-27 01:23:00 +03:00
Don't need the extra status declarations for some of the Hspec tests
at level04 as hspec-wai assumes 200 until told otherwise.

Removed Hedgehog from level04 tests, don't have a good use case.
This commit is contained in:
Sean Chalmers 2017-08-11 15:54:21 +10:00
parent 8f8bb6c123
commit 803e6c58e9
3 changed files with 8 additions and 8 deletions

View File

@ -41,7 +41,7 @@ Tonys simpler version:
* Level 03 : Add some flexible configuration * Level 03 : Add some flexible configuration
-- Working on this one... -- Working on this one...
* Level 04 : Testing & Tools (tasty/hedgehog & ghcid) * Level 04 : Testing & Tools (hspec & ghcid)
* Level 05 : Database layer (postgresql-simple) * Level 05 : Database layer (postgresql-simple)
* Level 06 : ReaderT & Refactoring * Level 06 : ReaderT & Refactoring

View File

@ -1,4 +1,4 @@
{ {
"foo": 33, "port": 33,
"bar": "Fred" "helloMsg": "Oh, hurro!"
} }

View File

@ -34,20 +34,20 @@ main = do
describe "POST /topic/add" $ do describe "POST /topic/add" $ do
it "Should return 200 with well formed request" $ do it "Should return 200 with well formed request" $ do
post "/fudge/add" "Fred" `shouldRespondWith` msg { matchStatus = 200 } post "/fudge/add" "Fred" `shouldRespondWith` msg
it "Should 400 on empty input" $ it "Should 400 on empty input" $
post "/fudge/add" "" `shouldRespondWith` 400 post "/fudge/add" "" `shouldRespondWith` 400
it "Should add a comment to the topic" it "Should add a comment to the topic" $
Test.Hspec.Wai.pending Test.Hspec.Wai.pendingWith "No db attached, yet..."
-- ViewRq Spec -- ViewRq Spec
describe "GET /topic/view" $ do describe "GET /topic/view" $ do
it "Should return 200 with content" $ it "Should return 200 with content" $
get "/fudge/view" `shouldRespondWith` "Susan was ere" { matchStatus = 200 } get "/fudge/view" `shouldRespondWith` "Susan was ere"
-- ListRq Spec -- ListRq Spec
describe "GET /list" $ do describe "GET /list" $ do
it "Should return 200 with content" $ it "Should return 200 with content" $
get "/list" `shouldRespondWith` "[ \"Fred wuz ere\", \"Susan was ere\" ]" { matchStatus = 200 } get "/list" `shouldRespondWith` "[ \"Fred wuz ere\", \"Susan was ere\" ]"