Skip to content

Commit

Permalink
fix failing serialization test
Browse files Browse the repository at this point in the history
  • Loading branch information
sisyphusSmiling committed Oct 22, 2024
1 parent a5630a7 commit b441888
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cadence/contracts/utils/SerializeMetadata.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ access(all) contract SerializeMetadata {
}
serializedResult = serializedResult.concat("{")
.concat("\"trait_type\": ").concat(Serialize.tryToJSONString(trait.name)!)
.concat(", \"display_type\": ").concat(Serialize.tryToJSONString(trait.display_type)!)
.concat(", \"display_type\": ").concat(Serialize.tryToJSONString(trait.displayType)!)
.concat(", \"value\": ").concat(value!)
.concat("}")
if i < traits!.traits.length - 1 {
Expand Down
4 changes: 2 additions & 2 deletions cadence/tests/serialize_metadata_tests.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ fun testSerializeNFTSucceeds() {
let heightString = mintedBlockHeight.toString()

let expectedPrefix = "data:application/json;utf8,{\"name\": \"ExampleNFT\", \"description\": \"Example NFT Collection\", \"image\": \"https://flow.com/examplenft.jpg\", \"external_url\": \"https://example-nft.onflow.org\", "
let altSuffix1 = "\"attributes\": [{\"trait_type\": \"mintedBlock\", \"value\": \"".concat(heightString).concat("\"},{\"trait_type\": \"foo\", \"value\": \"nil\"}]}")
let altSuffix2 = "\"attributes\": [{\"trait_type\": \"foo\", \"value\": \"nil\"}]}, {\"trait_type\": \"mintedBlock\", \"value\": \"".concat(heightString).concat("\"}")
let altSuffix1 = "\"attributes\": [{\"trait_type\": \"mintedBlock\", \"display_type\": \"nil\", \"value\": \"".concat(heightString).concat("\"},{\"trait_type\": \"foo\", \"display_type\": \"nil\", \"value\": \"nil\"}]}")
let altSuffix2 = "\"attributes\": [{\"trait_type\": \"foo\", \"display_type\": \"nil\", \"value\": \"nil\"}]}, {\"trait_type\": \"mintedBlock\", \"display_type\": \"nil\", \"value\": \"".concat(heightString).concat("\"}")

let idsResult = executeScript(
"../scripts/nft/get_ids.cdc",
Expand Down

0 comments on commit b441888

Please sign in to comment.