bankrun.test.ts 985 B

1234567891011121314151617181920212223
  1. import { describe, it } from 'node:test';
  2. import * as anchor from '@coral-xyz/anchor';
  3. import { PublicKey } from '@solana/web3.js';
  4. import { BankrunProvider } from 'anchor-bankrun';
  5. import { startAnchor } from 'solana-bankrun';
  6. import type { ProcessingInstructions } from '../target/types/processing_instructions';
  7. const IDL = require('../target/idl/processing_instructions.json');
  8. const PROGRAM_ID = new PublicKey(IDL.address);
  9. describe('custom-instruction-data', async () => {
  10. const context = await startAnchor('', [{ name: 'processing_instructions', programId: PROGRAM_ID }], []);
  11. const provider = new BankrunProvider(context);
  12. const payer = provider.wallet as anchor.Wallet;
  13. const program = new anchor.Program<ProcessingInstructions>(IDL, provider);
  14. it('Go to the park!', async () => {
  15. // Anchor makes it super simple.
  16. await program.methods.goToPark('Jimmy', 3).accounts({}).rpc();
  17. await program.methods.goToPark('Mary', 10).accounts({}).rpc();
  18. });
  19. });