packages feed

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

{-# OPTIONS_GHC -fno-warn-orphans #-}module TodoSpec whereimport Data.Aesonimport qualified Data.ByteString.Lazy.Char8 as BL8import Servant.Swagger.Testimport Test.Hspecimport Test.QuickCheckimport Test.QuickCheck.Instances ()import Todoimport Paths_examplespec :: 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