Skip to content

Lesson 14, Random IPFS NFT Test #257

Answered by PatrickAlphaC
0xC4LL3 asked this question in Q&A
Discussion options

You must be logged in to vote

There is a difference :)

-The promise-based one is a more realistic version

  • The non-promise-based one will only work on a local net

Rationale

In your test, when you run: const tokenUri = await randomIpfsNft.getDogTokenUris(0), this assumes that the tokenURI of the dog has already been created. On a local net, we ran 👍

await expect(
                      vrfCoordinatorV2Mock.fulfillRandomWords(requestId, randomIpfsNft.address)
                  ).to.emit(randomIpfsNft, "NftMinted")

To mock the chainlink node response. But on a real network, we'd have to await for the Chainlink node to respond. So we setup a listener inside a promise to listen for the response before we make the call to m…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@0xC4LL3
Comment options

Answer selected by 0xC4LL3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants