diff --git a/README.md b/README.md index c666459..e66e6ea 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ Tonys simpler version: * Level 03 : Add some flexible configuration -- Working on this one... -* Level 04 : Testing & Tools (tasty/hedgehog & ghcid) +* Level 04 : Testing & Tools (hspec & ghcid) * Level 05 : Database layer (postgresql-simple) * Level 06 : ReaderT & Refactoring diff --git a/level04/appconfig.json b/level04/appconfig.json index 22a9b6b..2cfda6b 100644 --- a/level04/appconfig.json +++ b/level04/appconfig.json @@ -1,4 +1,4 @@ { - "foo": 33, - "bar": "Fred" + "port": 33, + "helloMsg": "Oh, hurro!" } diff --git a/level04/tests/Test.hs b/level04/tests/Test.hs index e5774a5..122b7f4 100644 --- a/level04/tests/Test.hs +++ b/level04/tests/Test.hs @@ -34,20 +34,20 @@ main = do describe "POST /topic/add" $ 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" $ post "/fudge/add" "" `shouldRespondWith` 400 - it "Should add a comment to the topic" - Test.Hspec.Wai.pending + it "Should add a comment to the topic" $ + Test.Hspec.Wai.pendingWith "No db attached, yet..." -- ViewRq Spec describe "GET /topic/view" $ do it "Should return 200 with content" $ - get "/fudge/view" `shouldRespondWith` "Susan was ere" { matchStatus = 200 } + get "/fudge/view" `shouldRespondWith` "Susan was ere" -- ListRq Spec describe "GET /list" $ do 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\" ]"