test.ts 637 B

12345678910111213141516171819202122
  1. import * as anchor from "@project-serum/anchor";
  2. import { AnchorProgramExample } from "../target/types/anchor_program_example";
  3. describe("Anchor example", () => {
  4. // Configure the Anchor provider & load the program IDL
  5. // The IDL gives you a typescript module
  6. //
  7. const provider = anchor.AnchorProvider.env();
  8. anchor.setProvider(provider);
  9. const program = anchor.workspace.AnchorProgramExample as anchor.Program<AnchorProgramExample>;
  10. it("Test our example", async () => {
  11. // Just run Anchor's IDL method to build a transaction!
  12. //
  13. await program.methods.hello()
  14. .accounts({})
  15. .rpc();
  16. });
  17. });