@@ -2,8 +2,9 @@
3module SchemaSpec (spec, main) where
3module SchemaSpec (spec, main) where
5−import Data.ByteString.Lazy
6import Data.Aeson
5import Data.Aeson
6+import Data.ByteString.Lazy
7+import Data.Functor.Identity
7import Data.Proxy
8import Data.Proxy
8import Data.Schematic
9import Data.Schematic
9import Data.Vinyl
10import Data.Vinyl
@@ -44,14 +45,6 @@ topObject = ReprObject $
44 :& FieldRepr (ReprText "test")
45 :& FieldRepr (ReprText "test")
51− '[ '("foo", 'SchemaNumber '[]), '("bar", 'SchemaText '[])])
53− migrate = const topObject
55spec :: Spec
48spec :: Spec
57 -- it "show/read JsonRepr properly" $
50 -- it "show/read JsonRepr properly" $
@@ -67,13 +60,15 @@ spec = do
67 it "validates incorrect representation" $
60 it "validates incorrect representation" $
68 ((decodeAndValidateJson schemaJson2) :: ParseResult (JsonRepr SchemaExample))
61 ((decodeAndValidateJson schemaJson2) :: ParseResult (JsonRepr SchemaExample))
69 `shouldSatisfy` isValidationError
62 `shouldSatisfy` isValidationError
70− it "validates versioned json" $ do
63+ -- it "validates versioned json" $ do
71− decodeAndValidateVersionedJson (Proxy @VS) schemaJson
64+ -- decodeAndValidateVersionedJson (Proxy @VS) schemaJson
72− `shouldSatisfy` isValid
65+ -- `shouldSatisfy` isValid
73 it "validates versioned json with a migration list" $ do
66 it "validates versioned json with a migration list" $ do
74− decodeAndValidateVersionedWithMList
67+ decodeAndValidateVersionedWithPureMList
75 (Proxy @VS)
68 (Proxy @VS)
76− ((:&&) (Proxy @(SchemaByRevision "test_revision" VS)) (const topObject) MNil)
70+ (Proxy @(SchemaByRevision "test_revision" VS))
71+ (const $ Identity topObject) MNil)
77 schemaJson
72 schemaJson
78 `shouldSatisfy` isValid
73 `shouldSatisfy` isValid