1- import { describe , it } from ' node:test' ;
2- import * as anchor from ' @coral-xyz/anchor' ;
3- import { Keypair , LAMPORTS_PER_SOL , PublicKey } from ' @solana/web3.js' ;
4- import { BankrunProvider } from ' anchor-bankrun' ;
5- import { assert } from ' chai' ;
6- import { startAnchor } from ' solana-bankrun' ;
7- import type { PdaRentPayer } from ' ../target/types/pda_rent_payer' ;
8-
9- const IDL = require ( ' ../target/idl/pda_rent_payer.json' ) ;
1+ import { describe , it } from " node:test" ;
2+ import * as anchor from " @coral-xyz/anchor" ;
3+ import { Keypair , LAMPORTS_PER_SOL , PublicKey } from " @solana/web3.js" ;
4+ import { BankrunProvider } from " anchor-bankrun" ;
5+ import { assert } from " chai" ;
6+ import { startAnchor } from " solana-bankrun" ;
7+ import type { PdaRentPayer } from " ../target/types/pda_rent_payer" ;
8+
9+ import { IDL } from " ../target/idl/pda_rent_payer.json" ;
1010const PROGRAM_ID = new PublicKey ( IDL . address ) ;
1111
12- describe ( 'PDA Rent-Payer' , async ( ) => {
13- const context = await startAnchor ( '' , [ { name : 'pda_rent_payer' , programId : PROGRAM_ID } ] , [ ] ) ;
12+ describe ( "PDA Rent-Payer" , async ( ) => {
13+ const context = await startAnchor (
14+ "" ,
15+ [ { name : "pda_rent_payer" , programId : PROGRAM_ID } ] ,
16+ [ ] ,
17+ ) ;
1418 const provider = new BankrunProvider ( context ) ;
1519 const program = new anchor . Program < PdaRentPayer > ( IDL , provider ) ;
1620
1721 const wallet = provider . wallet as anchor . Wallet ;
1822 const connection = provider . connection ;
1923
2024 // PDA for the Rent Vault
21- const [ rentVaultPDA ] = PublicKey . findProgramAddressSync ( [ Buffer . from ( 'rent_vault' ) ] , program . programId ) ;
25+ const [ rentVaultPDA ] = PublicKey . findProgramAddressSync (
26+ [ Buffer . from ( "rent_vault" ) ] ,
27+ program . programId ,
28+ ) ;
2229
23- it ( ' Initialize the Rent Vault' , async ( ) => {
30+ it ( " Initialize the Rent Vault" , async ( ) => {
2431 // 1 SOL
2532 const fundAmount = new anchor . BN ( LAMPORTS_PER_SOL ) ;
2633
@@ -32,11 +39,12 @@ describe('PDA Rent-Payer', async () => {
3239 . rpc ( ) ;
3340
3441 // Check rent vault balance
35- const accountInfo = await program . provider . connection . getAccountInfo ( rentVaultPDA ) ;
42+ const accountInfo =
43+ await program . provider . connection . getAccountInfo ( rentVaultPDA ) ;
3644 assert ( accountInfo . lamports === fundAmount . toNumber ( ) ) ;
3745 } ) ;
3846
39- it ( ' Create a new account using the Rent Vault' , async ( ) => {
47+ it ( " Create a new account using the Rent Vault" , async ( ) => {
4048 // Generate a new keypair for the new account
4149 const newAccount = new Keypair ( ) ;
4250
0 commit comments