packages feed

servant-swagger-1.2 / example / test / TodoSpec.hs

{-# OPTIONS_GHC -fno-warn-orphans #-}module TodoSpec whereimport Prelude ()import Prelude.Compatimport           Data.Aesonimport qualified Data.ByteString.Lazy.Char8 as BL8import           Paths_exampleimport           Servant.Swagger.Testimport           Test.Hspecimport           Test.QuickCheckimport           Test.QuickCheck.Instances  ()import           Todospec :: Specspec = describe "Swagger" $ do  context "ToJSON matches ToSchema" $ validateEveryToJSON todoAPI  it "swagger.json is up-to-date" $ do    path <- getDataFileName "swagger.json"    swag <- eitherDecode <$> BL8.readFile path    swag `shouldBe` Right todoSwaggerinstance Arbitrary Todo where  arbitrary = Todo <$> arbitrary <*> arbitraryinstance Arbitrary TodoId where  arbitrary = TodoId <$> arbitrary