Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions tests/integration/tests/test-delegation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { ON_CURVE_ACCOUNT } from "./fixtures/consts";
import { assert } from "chai";

const SEED_TEST_PDA = "test-pda";
const SEED_TEST_PDA_OTHER = "test-pda-other";
const BPF_LOADER = new web3.PublicKey(
"BPFLoaderUpgradeab1e11111111111111111111111"
);
Expand All @@ -28,6 +29,10 @@ describe("TestDelegation", () => {
[Buffer.from(SEED_TEST_PDA)],
testDelegation.programId
);
const [pdaOther] = anchor.web3.PublicKey.findProgramAddressSync(
[Buffer.from(SEED_TEST_PDA_OTHER)],
testDelegation.programId
);
const payer = provider.wallet.publicKey;
const admin = provider.wallet.publicKey;
const validator = provider.wallet.publicKey;
Expand Down Expand Up @@ -88,18 +93,18 @@ describe("TestDelegation", () => {

it("Initializes another counter", async () => {
// Check if the counter is initialized
const counterAccountInfo = await provider.connection.getAccountInfo(pda);
const counterAccountInfo = await provider.connection.getAccountInfo(pdaOther);
if (counterAccountInfo === null) {
const tx = await testDelegation.methods
.initializeOther()
.accounts({
user: provider.wallet.publicKey,
})
.rpc({ skipPreflight: true });
console.log("Init Pda Tx: ", tx);
console.log("Init Other Pda Tx: ", tx);
}
const counterAccount = await testDelegation.account.counter.fetch(pda);
console.log("Counter: ", counterAccount.count.toString());
const counterAccount = await testDelegation.account.counter.fetch(pdaOther);
console.log("Counter (other): ", counterAccount.count.toString());
});

it("Increase the counter", async () => {
Expand Down