From c09c8eb8de9c7cfb80333463b760e50d865055af Mon Sep 17 00:00:00 2001 From: Viki Val Date: Thu, 19 Oct 2023 15:31:22 +0200 Subject: [PATCH] :test_tube: proof_of_chaos metadata --- hyperdata/tests/content.test.ts | 20 +++++++++++- hyperdata/tests/examples/proof-of-chaos.json | 32 ++++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 hyperdata/tests/examples/proof-of-chaos.json diff --git a/hyperdata/tests/content.test.ts b/hyperdata/tests/content.test.ts index 154966ad..755d4cb9 100644 --- a/hyperdata/tests/content.test.ts +++ b/hyperdata/tests/content.test.ts @@ -1,7 +1,8 @@ import { describe, expect, it } from 'vitest' -import { OpenSeaMetadata, 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`, () => { @@ -53,4 +54,21 @@ describe('contentFrom', () => { 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', + }) + }) }) diff --git a/hyperdata/tests/examples/proof-of-chaos.json b/hyperdata/tests/examples/proof-of-chaos.json new file mode 100644 index 00000000..20622392 --- /dev/null +++ b/hyperdata/tests/examples/proof-of-chaos.json @@ -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 } + ] +}