@@ -15,31 +15,9 @@ import qualified Data.Vector as Vector
15import Data.Text (Text)
15import Data.Text (Text)
17import Data.Swagger
17import Data.Swagger
19import Test.Hspec
19import Test.Hspec
21−isSubJSON :: Value -> Value -> Bool
22−isSubJSON Null _ = True
23−isSubJSON (Object x) (Object y) = HashMap.keys x == HashMap.keys i && F.and i
25− i = HashMap.intersectionWith isSubJSON x y
26−isSubJSON (Array xs) (Array ys) = Vector.length xs == Vector.length ys && F.and (Vector.zipWith isSubJSON xs ys)
27−isSubJSON x y = x == y
29−(<~>) :: (Eq a, Show a, ToJSON a, FromJSON a) => a -> Value -> Spec
31− it "encodes correctly (probably with extra properties)" $ do
32− toJSON x `shouldSatisfy` (json `isSubJSON`)
33− it "decodes correctly" $ do
34− fromJSON json `shouldBe` Success x
36−(<=>) :: (Eq a, Show a, ToJSON a, FromJSON a) => a -> Value -> Spec
38− it "encodes correctly" $ do
39− toJSON x `shouldBe` json
40− it "decodes correctly" $ do
41− fromJSON json `shouldBe` Success x
43spec :: Spec
21spec :: Spec
45 describe "License Object" $ licenseExample <=> licenseExampleJSON
23 describe "License Object" $ licenseExample <=> licenseExampleJSON