Skip to content

Commit

Permalink
Merge pull request #172 from kodadot/hyperdata/more-teeeests
Browse files Browse the repository at this point in the history
(:test_tube:) Testing the hyperdata
  • Loading branch information
vikiival authored Nov 6, 2023
2 parents ded39fb + c09c8eb commit 55e8fcc
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 1 deletion.
54 changes: 53 additions & 1 deletion hyperdata/tests/content.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { describe, expect, it } from 'vitest'
import { TezosMetadata, contentFrom } from '../src'
import { OpenSeaMetadata, TezosMetadata, contentFrom, attributeFrom } from '../src'
import fxhash from './examples/fxhash.json'
import koda from './examples/koda.json'
import poc from './examples/proof-of-chaos.json'

describe('contentFrom', () => {
it(`should parse FXhash metadata to Content correctly`, () => {
Expand All @@ -19,4 +21,54 @@ describe('contentFrom', () => {
type: '',
})
})

it(`should parse Koda metadata to Content correctly`, () => {
const metadata = koda as OpenSeaMetadata
expect(contentFrom(metadata)).toStrictEqual({
_raw: undefined,
name: metadata.name,
description: metadata.description,
image: metadata.image,
animationUrl: metadata.animation_url,
attributes: [
{
display: '',
trait: 'ID',
value: '1082',
},
{
display: '',
trait: 'Type',
value: 'Dolphin',
},
{
display: '',
trait: 'Rarity',
value: 'Rare',
},
],
externalUrl: metadata.external_url,
generative: undefined,
tags: [],
thumbnail: undefined,
type: '',
})
})

it(`should parse Proof of Chaos metadata to Content correctly`, () => {
const metadata = poc as OpenSeaMetadata
expect(contentFrom(metadata)).toStrictEqual({
_raw: undefined,
name: metadata.name,
description: metadata.description,
image: metadata.image,
animationUrl: metadata.animation_url,
attributes: metadata.attributes?.map(attributeFrom) || [],
externalUrl: metadata.external_url,
generative: undefined,
tags: [],
thumbnail: undefined,
type: 'video/mp4',
})
})
})
19 changes: 19 additions & 0 deletions hyperdata/tests/examples/koda.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "Rare Dolphin",
"image": "ipfs://QmR3YP9ZryaxQLuoChRFe7Fnmw6sisLVdt54ep8y9dS8Vq",
"description": "",
"attributes": [
{
"trait_type": "ID",
"value": "1082"
},
{
"trait_type": "Type",
"value": "Dolphin"
},
{
"trait_type": "Rarity",
"value": "Rare"
}
]
}
32 changes: 32 additions & 0 deletions hyperdata/tests/examples/proof-of-chaos.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"external_url": "https://www.proofofchaos.app/",
"mediaUri": "ipfs://ipfs/QmcfALNaGnYzujGiPWL2Q2PPBC7nBhr8JnT4bxFkFBH7gT",
"image": "ipfs://ipfs/Qmf1pn8Zsjk3NdgeVPufmRW68sMQH4MR5DqeSZ9UnqwD89",
"type": "video/mp4",
"animation_url": "ipfs://ipfs/QmcfALNaGnYzujGiPWL2Q2PPBC7nBhr8JnT4bxFkFBH7gT",
"name": "deef - afterlife review of moments in love - [epic]",
"description": "Herein lies the epic culmination, concealed yet not forgotten, in the form of 'deef - Afterlife Review of Moments in Love', the clandestine audiovisual finale from the forthcomming chronicles known as 'Love Loops Explorer' (2023/2024).\n\n[https://deef.xyz/](https://deef.xyz/)\n\n_This NFT was created with [proofofchaos.app](https://proofofchaos.app/referendum-rewards)_",
"attributes": [
{ "trait_type": "rarity", "value": "epic" },
{
"trait_type": "name",
"value": "deef - afterlife review of moments in love - [epic]"
},
{
"trait_type": "description",
"value": "Herein lies the epic culmination, concealed yet not forgotten, in the form of 'deef - Afterlife Review of Moments in Love', the clandestine audiovisual finale from the forthcomming chronicles known as 'Love Loops Explorer' (2023/2024)."
},
{ "trait_type": "artist", "value": "deef" },
{ "trait_type": "referendum", "value": 99 },
{
"trait_type": "recipient",
"value": [
["HAPBZTbxZd4gtptAZwU3XjbFs2d1FnQ6sKd7W8FAAsJmKCw", 80],
["Go8NpTvzdpfpK1rprXW1tE4TFTHtd2NDJCqZLw5V77GR8r4", 20]
]
},
{ "trait_type": "totalSupply", "value": 427 },
{ "trait_type": "totalSupplyRarity", "value": 33 },
{ "trait_type": "royalty", "value": 30 }
]
}

0 comments on commit 55e8fcc

Please sign in to comment.