packages feed

hspec-golden-aeson 0.3.1.0 → 0.4.0.0

raw patch · 3 files changed

+27/−6 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

hspec-golden-aeson.cabal view
@@ -3,7 +3,7 @@ -- see: https://github.com/sol/hpack  name:           hspec-golden-aeson-version:        0.3.1.0+version:        0.4.0.0 synopsis:       Use tests to monitor changes in Aeson serialization description:    Use tests to monitor changes in Aeson serialization category:       Testing
src/Test/Aeson/Internal/ADT/GoldenSpecs.hs view
@@ -41,10 +41,6 @@ import           Test.QuickCheck import           Test.QuickCheck.Arbitrary.ADT --import           Data.Monoid ((<>))-- -- | Tests to ensure that JSON encoding has not unintentionally changed. This -- could be caused by the following: --@@ -171,7 +167,7 @@   (typeName, constructors) <- fmap (adtTypeName &&& adtCAPs) <$> generate $ toADTArbitrary (Proxy :: Proxy a)   mapM_     (\constructor -> do-        let goldenFile = goldenPath <> "/" <> typeName <> ".json"+        let goldenFile = goldenPath </> typeName </> capConstructor constructor <.> ".json"         exists <- doesFileExist goldenFile         if exists           then pure ()
test/Test/Aeson/GenericSpecsSpec.hs view
@@ -171,5 +171,30 @@       (s1,_) <- hspecSilently $ goldenADTSpecs defaultSettings (Proxy :: Proxy TAS.Person)       summaryFailures s1 `shouldBe` 1 +  describe "mkGoldenFileForType" $ do+    it "create a single file in a dir for a Product type" $ do+      -- clean up previously existing golden folder+      bg <- doesDirectoryExist "golden"+      if bg+        then removeDirectoryRecursive "golden"+        else pure ()++      mkGoldenFileForType 10 (Proxy :: Proxy T.Person) "golden"+      doesFileExist "golden/Person/Person.json"    `shouldReturn` True++    it "create a file for each constructor in a dir for a Sum type" $ do+      -- clean up previously existing golden folder+      bg <- doesDirectoryExist "golden"+      if bg+        then removeDirectoryRecursive "golden"+        else pure ()++      mkGoldenFileForType 10 (Proxy :: Proxy T.SumType) "golden"+      doesFileExist "golden/SumType/SumType1.json" `shouldReturn` True+      doesFileExist "golden/SumType/SumType2.json" `shouldReturn` True+      doesFileExist "golden/SumType/SumType3.json" `shouldReturn` True+++ main :: IO () main = hspec spec