Skip to content

Commit

Permalink
Fix JS tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lorisleiva committed Jun 6, 2023
1 parent 5c8900c commit 03197cb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
22 changes: 19 additions & 3 deletions clients/js/test/burnV1.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { generateSigner } from '@metaplex-foundation/umi';
import {
assertAccountExists,
generateSigner,
sol
} from '@metaplex-foundation/umi';
import test from 'ava';
import {
TokenStandard,
Expand Down Expand Up @@ -33,10 +37,16 @@ test('it can burn a NonFungible', async (t) => {
}).sendAndConfirm(umi);

// Then the following accounts have been deleted.
t.false(await umi.rpc.accountExists(da.metadata.publicKey));
t.false(await umi.rpc.accountExists(da.edition!.publicKey));
t.false(await umi.rpc.accountExists(da.token.publicKey));

// And the Metadata account still exists but it was drained and is left with the create fees.
const metadata = await umi.rpc.getAccount(da.metadata.publicKey);
t.true(metadata.exists);
assertAccountExists(metadata);
t.deepEqual(metadata.lamports, sol(0.01));
t.is(metadata.data.length, 0);

// But the mint account still exists.
t.true(await umi.rpc.accountExists(mint));
});
Expand Down Expand Up @@ -64,11 +74,17 @@ test('it can burn a ProgrammableNonFungible', async (t) => {
}).sendAndConfirm(umi);

// Then the following accounts have been deleted.
t.false(await umi.rpc.accountExists(da.metadata.publicKey));
t.false(await umi.rpc.accountExists(da.edition!.publicKey));
t.false(await umi.rpc.accountExists(da.token.publicKey));
t.false(await umi.rpc.accountExists(da.tokenRecord!.publicKey));

// And the Metadata account still exists but it was drained and is left with the create fees.
const metadata = await umi.rpc.getAccount(da.metadata.publicKey);
t.true(metadata.exists);
assertAccountExists(metadata);
t.deepEqual(metadata.lamports, sol(0.01));
t.is(metadata.data.length, 0);

// But the mint account still exists.
t.true(await umi.rpc.accountExists(mint));
});
Expand Down
4 changes: 3 additions & 1 deletion clients/js/test/createV1.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
Mint,
} from '@metaplex-foundation/mpl-toolbox';
import {
addAmounts,
generateSigner,
none,
percentAmount,
Expand Down Expand Up @@ -346,6 +347,7 @@ test('an explicit payer can be used for storage fees', async (t) => {

// Then the payer has paid the storage fees.
const storageFees = await builder.getRentCreatedOnChain(umi);
const totalFees = addAmounts(storageFees, sol(0.01)); // Create fee.
const payerBalance = await umi.rpc.getBalance(payer.publicKey);
t.deepEqual(payerBalance, subtractAmounts(sol(10), storageFees));
t.deepEqual(payerBalance, subtractAmounts(sol(10), totalFees));
});

0 comments on commit 03197cb

Please sign in to comment.