Skip to content

Commit

Permalink
Simplify test using UpdateArgsArgs
Browse files Browse the repository at this point in the history
  • Loading branch information
danenbm committed Jan 12, 2024
1 parent 078df86 commit a82b42d
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions clients/js/test/updateMetadata.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import test from 'ava';
import {
MetadataArgsArgs,
UpdateArgsArgs,
fetchMerkleTree,
getCurrentRoot,
hashLeaf,
Expand Down Expand Up @@ -66,14 +67,9 @@ test('it update the metadata of a minted compressed NFT', async (t) => {
t.is(merkleTreeAccount.tree.rightMostPath.leaf, publicKey(leaf));

// And when metadata is updated.
const update_args: UpdateArgs = {
const updateArgs: UpdateArgsArgs = {
name: some('New name'),
symbol: none(),
uri: some('https://updated-example.com/my-nft.json'),
creators: none(),
sellerFeeBasisPoints: none(),
primarySaleHappened: none(),
isMutable: none(),
};

await updateMetadata(umi, {
Expand All @@ -84,7 +80,7 @@ test('it update the metadata of a minted compressed NFT', async (t) => {
index: 0,
currentMetadata: metadata,
proof: [],
updateArgs: update_args,
updateArgs,
}).sendAndConfirm(umi);

// Then the leaf was updated in the merkle tree.
Expand Down Expand Up @@ -159,20 +155,15 @@ test('it can update metadata using the getAssetWithProof helper', async (t) => {
const assetWithProof = await getAssetWithProof(umi, assetId);

// Then we can use it to update metadata for the NFT.
const update_args: UpdateArgs = {
name: some('New name'),
symbol: none(),
uri: some('https://updated-example.com/my-nft.json'),
creators: none(),
sellerFeeBasisPoints: none(),
primarySaleHappened: none(),
isMutable: none(),
};
const updateArgs: UpdateArgsArgs = {
name: some('New name'),
uri: some('https://updated-example.com/my-nft.json'),
};

await updateMetadata(umi, {
...assetWithProof,
currentMetadata: metadata,
updateArgs: update_args,
updateArgs,
}).sendAndConfirm(umi);

// And the full asset and proof responses can be retrieved.
Expand Down

0 comments on commit a82b42d

Please sign in to comment.