Skip to content

Commit

Permalink
Assert for all the log messages received from a tx (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
ksolana authored May 18, 2024
1 parent 1176ca2 commit bd62ad7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions basics/hello-solana/native/tests/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
} from '@solana/web3.js';
import { start } from 'solana-bankrun';
import { describe, test } from 'node:test';
import { assert } from "chai";

describe('hello-solana', async () => {
// load program in solana-bankrun
Expand All @@ -28,6 +29,12 @@ describe('hello-solana', async () => {

// Now we process the transaction
let transaction = await client.processTransaction(tx);
console.log(transaction?.meta?.logMessages);
});

assert(transaction.logMessages[0].startsWith("Program " + PROGRAM_ID));
assert(transaction.logMessages[1] === "Program log: Hello, Solana!");
assert(transaction.logMessages[2] === "Program log: Our program's Program ID: " + PROGRAM_ID);
assert(transaction.logMessages[3].startsWith("Program " + PROGRAM_ID + " consumed"));
assert(transaction.logMessages[4] === "Program " + PROGRAM_ID + " success");
assert(transaction.logMessages.length == 5);
});
});

0 comments on commit bd62ad7

Please sign in to comment.