diff --git a/tests/escrow/tests/escrow.ts b/tests/escrow/tests/escrow.ts index 2b1c8f392a..8a7d1481fc 100644 --- a/tests/escrow/tests/escrow.ts +++ b/tests/escrow/tests/escrow.ts @@ -116,6 +116,16 @@ describe("escrow", () => { }); it("Initialize escrow", async () => { + const [escrowPda, _nonce] = await PublicKey.findProgramAddress( + [ + Buffer.from(anchor.utils.bytes.utf8.encode("escrow")), + tokenProgramIdA.toBuffer(), + ], + program.programId + ); + + pda = escrowPda; + await program.rpc.initializeEscrow( new BN(initializerAmount), new BN(takerAmount), @@ -132,14 +142,6 @@ describe("escrow", () => { } ); - // Get the PDA that is assigned authority to token account. - const [_pda, _nonce] = await PublicKey.findProgramAddress( - [Buffer.from(anchor.utils.bytes.utf8.encode("escrow"))], - program.programId - ); - - pda = _pda; - let _initializerTokenAccountA = await mintA.getAccountInfo( initializerTokenAccountA ); @@ -230,6 +232,16 @@ describe("escrow", () => { initializerAmount ); + const [escrowPda, _nonce] = await PublicKey.findProgramAddress( + [ + Buffer.from(anchor.utils.bytes.utf8.encode("escrow")), + tokenProgramIdA.toBuffer(), + ], + program.programId + ); + + pda = escrowPda; + await program.rpc.initializeEscrow( new BN(initializerAmount), new BN(takerAmount),