summaryrefslogtreecommitdiff
path: root/test/Spec.hs
diff options
context:
space:
mode:
Diffstat (limited to 'test/Spec.hs')
-rw-r--r--test/Spec.hs20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/Spec.hs b/test/Spec.hs
new file mode 100644
index 0000000..8aefe96
--- /dev/null
+++ b/test/Spec.hs
@@ -0,0 +1,20 @@
+{-# LANGUAGE QuasiQuotes #-}
+{-# LANGUAGE OverloadedStrings #-}
+module Main (main) where
+
+import Lib (app)
+import Test.Hspec
+import Test.Hspec.Wai
+import Test.Hspec.Wai.JSON
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = with (return app) $ do
+ describe "GET /users" $ do
+ it "responds with 200" $ do
+ get "/users" `shouldRespondWith` 200
+ it "responds with [User]" $ do
+ let users = "[{\"userId\":1,\"userFirstName\":\"Isaac\",\"userLastName\":\"Newton\"},{\"userId\":2,\"userFirstName\":\"Albert\",\"userLastName\":\"Einstein\"}]"
+ get "/users" `shouldRespondWith` users