1
0
mirror of https://github.com/alaudidaelark/coupon-servant.git synced 2026-03-07 22:12:34 +00:00

initial version with basic model - todo implement logic

added a swagger-generator

deriving coupontype automatically

implemented cors for swagger to work

fixed product model
This commit is contained in:
2017-05-05 00:16:45 +05:30
committed by Alaudidae
commit 1d44db32f0
18 changed files with 536 additions and 0 deletions

20
test/Spec.hs Normal file
View File

@@ -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