Skip to content

Commit

Permalink
chore: add test:
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos committed Jun 11, 2024
1 parent 1bb699e commit 198e6df
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions packages/api/test/nfts-list.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,31 @@ test.serial('should list only active nfts', async (t) => {
t.is(value.length, 1)
t.is(value[0].cid, cidv1)
})

test.serial('should list nfts with their parts', async (t) => {
const client = await createClientWithUser(t)
const mf = getMiniflareContext(t)
const cidv1 = 'bafybeiaj5yqocsg5cxsuhtvclnh4ulmrgsmnfbhbrfxrc3u2kkh35mts4e'
const cidv0 = 'QmP1QyqiRtQLbGBr5hLVX7NCmrJmJbGdp45x6DnPssMB9i'
const exampleCarParkUrl =
'https://carpark-dev.web3.storage/bagbaiera6xcx7hiicm7sc523axbjf2otuu5nptt6brdzt4a5ulgn6qcfdwea/bagbaiera6xcx7hiicm7sc523axbjf2otuu5nptt6brdzt4a5ulgn6qcfdwea.car'
const exampleS3Url = `https://dotstorage-dev-0.s3.us-east-1.amazonaws.com/raw/${cidv1}/2/ciqplrl7tuebgpzbo5nqlqus5hj2kowxzz7ayr4z6ao2ftg7ibcr3ca.car`
await client.client.createUpload({
content_cid: cidv1,
source_cid: cidv0,
type: 'Blob',
user_id: client.userId,
dag_size: 100,
backup_urls: [new URL(exampleCarParkUrl), new URL(exampleS3Url)],
})

const res = await mf.dispatchFetch('http://miniflare.test', {
headers: { Authorization: `Bearer ${client.token}` },
})
const { ok, value } = await res.json()

t.true(ok)
t.is(value.length, 1)
t.is(value[0].cid, cidv1)
console.log('backup', value[0])
})

0 comments on commit 198e6df

Please sign in to comment.