11import { appendTransactionMessageInstruction , generateKeyPairSigner , pipe } from '@solana/kit' ;
2- import test from 'ava ' ;
2+ import { expect , it } from 'vitest ' ;
33import { fetchMint , fetchToken , getApproveInstruction , getBurnCheckedInstruction } from '../src' ;
44import {
55 createDefaultSolanaClient ,
@@ -10,7 +10,7 @@ import {
1010 signAndSendTransaction ,
1111} from './_setup' ;
1212
13- test ( 'it burns tokens with correct decimals', async t => {
13+ it ( ' burns tokens with correct decimals', async ( ) => {
1414 // Given a mint with 9 decimals and a token account with 200 tokens.
1515 const client = createDefaultSolanaClient ( ) ;
1616 const [ payer , mintAuthority , owner ] = await Promise . all ( [
@@ -36,14 +36,14 @@ test('it burns tokens with correct decimals', async t => {
3636 ) ;
3737
3838 const { data : mintData } = await fetchMint ( client . rpc , mint ) ;
39- t . is ( mintData . supply , 175n ) ;
39+ expect ( mintData . supply ) . toBe ( 175n ) ;
4040
4141 // Then we expect the token account to have 175 tokens remaining.
4242 const { data : tokenData } = await fetchToken ( client . rpc , token ) ;
43- t . is ( tokenData . amount , 175n ) ;
43+ expect ( tokenData . amount ) . toBe ( 175n ) ;
4444} ) ;
4545
46- test ( 'it burns tokens using a delegate', async t => {
46+ it ( ' burns tokens using a delegate', async ( ) => {
4747 // Given a token account with 100 tokens and a delegate approved for 60 tokens.
4848 const client = createDefaultSolanaClient ( ) ;
4949 const [ payer , mintAuthority , owner , delegate ] = await Promise . all ( [
@@ -84,11 +84,11 @@ test('it burns tokens using a delegate', async t => {
8484
8585 // Then the token account should have 70 tokens remaining.
8686 const { data : tokenData } = await fetchToken ( client . rpc , token ) ;
87- t . is ( tokenData . amount , 70n ) ;
88- t . is ( tokenData . delegatedAmount , 30n ) ; // Remaining delegated amount
87+ expect ( tokenData . amount ) . toBe ( 70n ) ;
88+ expect ( tokenData . delegatedAmount ) . toBe ( 30n ) ; // Remaining delegated amount
8989} ) ;
9090
91- test ( 'it fails when decimals mismatch', async t => {
91+ it ( ' fails when decimals mismatch', async ( ) => {
9292 // Given a mint with 9 decimals and a token account with tokens.
9393 const client = createDefaultSolanaClient ( ) ;
9494 const [ payer , mintAuthority , owner ] = await Promise . all ( [
@@ -112,10 +112,10 @@ test('it fails when decimals mismatch', async t => {
112112 ) ;
113113
114114 // Then it should fail with MintDecimalsMismatch error.
115- await t . throwsAsync ( signAndSendTransaction ( client , transactionMessage ) ) ;
115+ await expect ( signAndSendTransaction ( client , transactionMessage ) ) . rejects . toThrow ( ) ;
116116} ) ;
117117
118- test ( 'it fails when burning more than account balance', async t => {
118+ it ( ' fails when burning more than account balance', async ( ) => {
119119 // Given a token account with only 50 tokens.
120120 const client = createDefaultSolanaClient ( ) ;
121121 const [ payer , mintAuthority , owner ] = await Promise . all ( [
@@ -139,10 +139,10 @@ test('it fails when burning more than account balance', async t => {
139139 ) ;
140140
141141 // Then it should fail with InsufficientFunds error.
142- await t . throwsAsync ( signAndSendTransaction ( client , transactionMessage ) ) ;
142+ await expect ( signAndSendTransaction ( client , transactionMessage ) ) . rejects . toThrow ( ) ;
143143} ) ;
144144
145- test ( 'it fails when authority is not a signer', async t => {
145+ it ( ' fails when authority is not a signer', async ( ) => {
146146 // Given a token account with tokens.
147147 const client = createDefaultSolanaClient ( ) ;
148148 const [ payer , mintAuthority , owner , wrongAuthority ] = await Promise . all ( [
@@ -167,10 +167,10 @@ test('it fails when authority is not a signer', async t => {
167167 ) ;
168168
169169 // Then it should fail (owner mismatch or missing signature).
170- await t . throwsAsync ( signAndSendTransaction ( client , transactionMessage ) ) ;
170+ await expect ( signAndSendTransaction ( client , transactionMessage ) ) . rejects . toThrow ( ) ;
171171} ) ;
172172
173- test ( 'it fails when delegate has insufficient delegated amount', async t => {
173+ it ( ' fails when delegate has insufficient delegated amount', async ( ) => {
174174 // Given a token account with 100 tokens and a delegate approved for only 20 tokens.
175175 const client = createDefaultSolanaClient ( ) ;
176176 const [ payer , mintAuthority , owner , delegate ] = await Promise . all ( [
@@ -208,10 +208,10 @@ test('it fails when delegate has insufficient delegated amount', async t => {
208208 ) ;
209209
210210 // Then it should fail with InsufficientFunds error.
211- await t . throwsAsync ( signAndSendTransaction ( client , transactionMessage ) ) ;
211+ await expect ( signAndSendTransaction ( client , transactionMessage ) ) . rejects . toThrow ( ) ;
212212} ) ;
213213
214- test ( 'it burns zero tokens successfully', async t => {
214+ it ( ' burns zero tokens successfully', async ( ) => {
215215 // Given a token account with tokens.
216216 const client = createDefaultSolanaClient ( ) ;
217217 const [ payer , mintAuthority , owner ] = await Promise . all ( [
@@ -238,5 +238,5 @@ test('it burns zero tokens successfully', async t => {
238238
239239 // Then the balance should remain unchanged.
240240 const { data : tokenData } = await fetchToken ( client . rpc , token ) ;
241- t . is ( tokenData . amount , 100n ) ;
241+ expect ( tokenData . amount ) . toBe ( 100n ) ;
242242} ) ;
0 commit comments