1- import { describe , test } from "node:test" ;
2- import {
3- PublicKey ,
4- Transaction ,
5- TransactionInstruction ,
6- } from "@solana/web3.js" ;
7- import { assert } from "chai" ;
8- import { start } from "solana-bankrun" ;
1+ import { describe , test } from 'node:test' ;
2+ import { PublicKey , Transaction , TransactionInstruction } from '@solana/web3.js' ;
3+ import { assert } from 'chai' ;
4+ import { start } from 'solana-bankrun' ;
95
10- describe ( " hello-solana" , async ( ) => {
6+ describe ( ' hello-solana' , async ( ) => {
117 // load program in solana-bankrun
12- const PROGRAM_ID = new PublicKey (
13- "z7msBPQHDJjTvdQRoEcKyENgXDhSRYeHieN1ZMTqo35" ,
14- ) ;
15- const context = await start (
16- [ { name : "hello_solana_program" , programId : PROGRAM_ID } ] ,
17- [ ] ,
18- ) ;
8+ const PROGRAM_ID = new PublicKey ( 'z7msBPQHDJjTvdQRoEcKyENgXDhSRYeHieN1ZMTqo35' ) ;
9+ const context = await start ( [ { name : 'hello_solana_program' , programId : PROGRAM_ID } ] , [ ] ) ;
1910 const client = context . banksClient ;
2011 const payer = context . payer ;
2112
22- test ( " Say hello!" , async ( ) => {
13+ test ( ' Say hello!' , async ( ) => {
2314 const blockhash = context . lastBlockhash ;
2415 // We set up our instruction first.
2516 const ix = new TransactionInstruction ( {
@@ -36,14 +27,9 @@ describe("hello-solana", async () => {
3627 const transaction = await client . processTransaction ( tx ) ;
3728
3829 assert ( transaction . logMessages [ 0 ] . startsWith ( `Program ${ PROGRAM_ID } ` ) ) ;
39- assert ( transaction . logMessages [ 1 ] === "Program log: Hello, Solana!" ) ;
40- assert (
41- transaction . logMessages [ 2 ] ===
42- `Program log: Our program's Program ID: ${ PROGRAM_ID } ` ,
43- ) ;
44- assert (
45- transaction . logMessages [ 3 ] . startsWith ( `Program ${ PROGRAM_ID } consumed` ) ,
46- ) ;
30+ assert ( transaction . logMessages [ 1 ] === 'Program log: Hello, Solana!' ) ;
31+ assert ( transaction . logMessages [ 2 ] === `Program log: Our program's Program ID: ${ PROGRAM_ID } ` ) ;
32+ assert ( transaction . logMessages [ 3 ] . startsWith ( `Program ${ PROGRAM_ID } consumed` ) ) ;
4733 assert ( transaction . logMessages [ 4 ] === `Program ${ PROGRAM_ID } success` ) ;
4834 assert ( transaction . logMessages . length === 5 ) ;
4935 } ) ;
0 commit comments