@@ -8,6 +8,7 @@ module Test.Cardano.Ledger.Core.JSON (
8
8
roundTripJsonEraSpec ,
9
9
roundTripJsonProperty ,
10
10
goldenJsonPParamsSpec ,
11
+ goldenJsonPParamsUpdateSpec ,
11
12
) where
12
13
13
14
import Cardano.Ledger.Core
@@ -20,6 +21,8 @@ import qualified Data.Text.Encoding as T
20
21
import Data.Typeable (Proxy (.. ), Typeable , typeRep )
21
22
import GHC.Stack
22
23
import Test.Cardano.Ledger.Common
24
+ import Test.Cardano.Ledger.Core.Arbitrary ()
25
+ import Test.Cardano.Ledger.Era (EraTest )
23
26
24
27
-- | QuickCheck property spec that uses `roundTripJsonProperty`
25
28
roundTripJsonSpec ::
@@ -51,8 +54,7 @@ roundTripJsonProperty original = do
51
54
roundTripJsonEraSpec ::
52
55
forall era .
53
56
( HasCallStack
54
- , EraPParams era
55
- , Arbitrary (PParams era )
57
+ , EraTest era
56
58
) =>
57
59
Spec
58
60
roundTripJsonEraSpec =
@@ -68,3 +70,14 @@ goldenJsonPParamsSpec =
68
70
it " Golden JSON specs for PParams " $ \ file -> do
69
71
decoded <- eitherDecodeFileStrict @ (PParams era ) file
70
72
void $ expectRightExpr decoded
73
+
74
+ goldenJsonPParamsUpdateSpec ::
75
+ forall era .
76
+ EraTest era =>
77
+ SpecWith FilePath
78
+ goldenJsonPParamsUpdateSpec =
79
+ it " Golden JSON specs for PParamsUpdate" $ \ file -> do
80
+ let ppu = runGen 100 100 (arbitrary @ (PParamsUpdate era ))
81
+ let encoded = T. decodeUtf8 $ BSL. toStrict $ encodePretty ppu
82
+ fileContent <- T. decodeUtf8 . BSL. toStrict <$> BSL. readFile file
83
+ encoded `shouldBe` fileContent
0 commit comments