Skip to content

Commit

Permalink
serializes policyid as raw byte string
Browse files Browse the repository at this point in the history
  • Loading branch information
bjornkihlberg committed Mar 27, 2023
1 parent d7b1654 commit 92aa67a
Showing 1 changed file with 6 additions and 4 deletions.
Expand Up @@ -88,18 +88,20 @@ spec = do
expected :: Either String CIP25Metadata
expected = Right $ CIP25Metadata $ CIP25MetadataLabel [(policyId, [])] (Just 2)
pure $ actual `shouldBe` expected
it "Serializes PolicyId as raw byte string" do
prop "Serializes PolicyId as raw byte string" do
((* 2) -> n) <- Gen.chooseInt (0, 32)
(key, policyId) <- (mkKey &&& mkPolicyId) <$> base16EncodedTextGen n
let input :: CIP25Metadata
input = CIP25Metadata $ CIP25MetadataLabel [("53756e", [])] (Just 2)
input = CIP25Metadata $ CIP25MetadataLabel [(policyId, [])] (Just 2)
actual :: BL.ByteString
actual = Aeson.encode input
expected :: BL.ByteString
expected = Aeson.encode $
Aeson.Object [("721", Aeson.Object
[ ("Sun", Aeson.Object [])
[ (key, Aeson.Object [])
, ("version", Aeson.Number 2)
])]
actual `shouldBe` expected
pure $ actual `shouldBe` expected
it "Parses TokenName as raw byte string" Hspec.pending
it "Serializes TokenName as raw byte string" Hspec.pending
it "Interprets version 2 as version 2" Hspec.pending
Expand Down

0 comments on commit 92aa67a

Please sign in to comment.