litesvm.test.ts 1.0 KB

1234567891011121314151617181920212223242526272829
  1. import * as anchor from '@coral-xyz/anchor';
  2. import { Program } from '@coral-xyz/anchor';
  3. import { Keypair } from '@solana/web3.js';
  4. import { LiteSVMProvider, fromWorkspace } from 'anchor-litesvm';
  5. import { ProcessingInstructions } from '../target/types/processing_instructions';
  6. const IDL = require('../target/idl/processing_instructions.json');
  7. describe('anchor', () => {
  8. let client: any;
  9. let provider: LiteSVMProvider;
  10. let program: Program<ProcessingInstructions>;
  11. let payer: Keypair;
  12. before(async () => {
  13. // Configure the Anchor provider & load the program IDL for LiteSVM
  14. // The IDL gives you a typescript module
  15. client = fromWorkspace('');
  16. provider = new LiteSVMProvider(client);
  17. payer = provider.wallet.payer;
  18. program = new anchor.Program<ProcessingInstructions>(IDL, provider);
  19. });
  20. it('Go to the park!', async () => {
  21. // Anchor makes it super simple.
  22. await program.methods.goToPark('Jimmy', 3).accounts({}).rpc();
  23. await program.methods.goToPark('Mary', 10).accounts({}).rpc();
  24. });
  25. });