瀏覽代碼

examples: Simplify tutorials/basic-3 test (#337)

keemy 4 年之前
父節點
當前提交
2f5a7d2cee
共有 2 個文件被更改,包括 2 次插入12 次删除
  1. 1 1
      examples/tutorial/basic-3/programs/puppet/src/lib.rs
  2. 1 11
      examples/tutorial/basic-3/tests/basic-3.js

+ 1 - 1
examples/tutorial/basic-3/programs/puppet/src/lib.rs

@@ -1,7 +1,7 @@
 use anchor_lang::prelude::*;
 
 #[program]
-mod puppet {
+pub mod puppet {
     use super::*;
     pub fn initialize(ctx: Context<Initialize>) -> ProgramResult {
         Ok(())

+ 1 - 11
examples/tutorial/basic-3/tests/basic-3.js

@@ -19,17 +19,7 @@ describe("basic-3", () => {
         rent: anchor.web3.SYSVAR_RENT_PUBKEY,
       },
       signers: [newPuppetAccount],
-      instructions: [
-        anchor.web3.SystemProgram.createAccount({
-          fromPubkey: provider.wallet.publicKey,
-          newAccountPubkey: newPuppetAccount.publicKey,
-          space: 8 + 8, // Add 8 for the account discriminator.
-          lamports: await provider.connection.getMinimumBalanceForRentExemption(
-            8 + 8
-          ),
-          programId: puppet.programId,
-        }),
-      ],
+      instructions: [await puppet.account.puppet.createInstruction(newPuppetAccount)],
     });
 
     // Invoke the puppet master to perform a CPI to the puppet.