@@ -12,6 +12,13 @@ import (
1212)
1313
1414func TestAssetUnmarshal (t * testing.T ) {
15+
16+ var onchainMetadata interface {} = map [string ]interface {}{
17+ "image" : "ipfs://ipfs/QmfKyJ4tuvHowwKQCbCHj4L5T3fSj8cjs7Aau8V7BWv226" ,
18+ "name" : "My NFT token" ,
19+ "description" : "optional" ,
20+ }
21+
1522 fp := filepath .Join (testdata , "json" , "assets" , "asset.json" )
1623 want := blockfrost.Asset {
1724 Asset : "b0d07d45fe9514f80213f4020e5a61241458be626841cde717cb38a76e7574636f696e" ,
@@ -21,10 +28,7 @@ func TestAssetUnmarshal(t *testing.T) {
2128 InitialMintTxHash : "6804edf9712d2b619edb6ac86861fe93a730693183a262b165fcc1ba1bc99cad" ,
2229 MintOrBurnCount : 1 ,
2330 Quantity : "12000" ,
24- OnchainMetadata : & blockfrost.AssetOnchainMetadata {
25- Image : "ipfs://ipfs/QmfKyJ4tuvHowwKQCbCHj4L5T3fSj8cjs7Aau8V7BWv226" ,
26- Name : "My NFT token" ,
27- },
31+ OnchainMetadata : & onchainMetadata ,
2832 Metadata : & blockfrost.AssetMetadata {
2933 Name : "nutcoin" ,
3034 Description : "The Nut Coin" ,
@@ -62,6 +66,18 @@ func TestResourceAssetIntegration(t *testing.T) {
6266 want := blockfrost.Asset {}
6367 testIntUtil (t , fp , & got , & want )
6468}
69+ func TestResourceAssetMetadataIntegration (t * testing.T ) {
70+ asset := "14696a4676909f4e3cb1f2e60e2e08e5abed70caf5c02699be97113943554259"
71+ api := blockfrost .NewAPIClient (blockfrost.APIClientOptions {})
72+
73+ got , err := api .Asset (context .TODO (), asset )
74+ if err != nil {
75+ t .Fatal (err )
76+ }
77+ fp := filepath .Join (testdata , strings .ToLower (strings .TrimLeft (t .Name (), "Test" ))+ ".golden" )
78+ want := blockfrost.Asset {}
79+ testIntUtil (t , fp , & got , & want )
80+ }
6581
6682func TestResourceAssetHistoryIntegration (t * testing.T ) {
6783 asset := "3a9241cd79895e3a8d65261b40077d4437ce71e9d7c8c6c00e3f658e4669727374636f696e"
0 commit comments