processing-instructions-program.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. import * as anchor from '@coral-xyz/anchor';
  2. import { Program } from '@coral-xyz/anchor';
  3. import { Keypair, PublicKey, SystemProgram } from '@solana/web3.js';
  4. import { assert } from 'chai';
  5. import { ProcessingInstructionsProgram } from '../target/types/processing_instructions_program';
  6. describe('processing_instructions_program', () => {
  7. // Configure the client to use the local cluster.
  8. const provider = anchor.AnchorProvider.env();
  9. anchor.setProvider(provider);
  10. const program = anchor.workspace.ProcessingInstructionsProgram as Program<ProcessingInstructionsProgram>;
  11. const payer = provider.wallet as anchor.Wallet;
  12. it('Tests the go_to_park function', async () => {
  13. // Define the test parameters
  14. const height = 6;
  15. const name = 'Alice';
  16. // Call the go_to_park function in the Solana program
  17. const tx = await program.methods
  18. .goToPark(height, name)
  19. .accounts({
  20. user: payer.publicKey,
  21. })
  22. .signers([payer.payer])
  23. .rpc();
  24. console.log('Your transaction signature', tx);
  25. // Assertions can be made here based on expected behavior
  26. // Since we are using msg! for console messages, we don't have a direct way to capture these outputs in tests
  27. // However, we can still verify the transaction was successful
  28. assert.isNotNull(tx, 'Transaction should be successful');
  29. });
  30. });