@@ -0,0 +1,56 @@
1+{-# LANGUAGE OverloadedStrings #-}
2+{-# LANGUAGE QuasiQuotes #-}
3+module Data.SwaggerSpec where
10+import Test.Hspec.HUnit
12+infoExample :: SwaggerInfo
13+infoExample = SwaggerInfo
14+ { swaggerInfoTitle = "Swagger Sample App"
15+ , swaggerInfoDescription = Just "This is a sample server Petstore server."
16+ , swaggerInfoTermsOfService = Just "http://swagger.io/terms/"
17+ , swaggerInfoContact = Just contact
18+ , swaggerInfoLicense = Just license
19+ , swaggerInfoVersion = "1.0.1" }
21+ contact = SwaggerContact
22+ { swaggerContactName = Just "API Support"
23+ , swaggerContactUrl = Just (URL "http://www.swagger.io/support")
24+ , swaggerContactEmail = Just "support@swagger.io" }
25+ license = SwaggerLicense
26+ { swaggerLicenseName = "Apache 2.0"
27+ , swaggerLicenseUrl = Just (URL "http://www.apache.org/licenses/LICENSE-2.0.html") }
29+infoExampleJSON :: Value
30+infoExampleJSON = [aesonQQ|
32+ "title": "Swagger Sample App",
33+ "description": "This is a sample server Petstore server.",
34+ "termsOfService": "http://swagger.io/terms/",
36+ "name": "API Support",
37+ "url": "http://www.swagger.io/support",
38+ "email": "support@swagger.io"
41+ "name": "Apache 2.0",
42+ "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
50+ describe "Info Object" $ do
51+ it "encodes correctly" $ do
52+ toJSON infoExample `shouldBe` infoExampleJSON