@niranjannlc @walletguy @ajdroi & @matthewrevell pleasee help an young develpoer..
Hi everyone, I am running into a persistent issue on Solana Playground where my Anchor integration test is failing with an AssertionError [ERR_ASSERTION]: Expected values to be strictly equal: 0 !== 1.
My smart contract includes a functional increment instruction, and my anchor.test.ts file correctly initializes the account and immediately calls the increment instruction right after. The code looks like this:
describe("counter", () => {
it("Increments", async () => {
const provider = anchor.AnchorProvider.env();
anchor.setProvider(provider);
const program = anchor.workspace.Counter;
const keypair = anchor.web3.Keypair.generate();
await program.methods.initialize().accounts({ counter: keypair.publicKey, authority: provider.wallet.publicKey }).signers([keypair]).rpc();
await program.methods.increment().accounts({ counter: keypair.publicKey, authority: provider.wallet.publicKey }).rpc();
const state = await program.account.counter.fetch(keypair.publicKey);
assert.strictEqual(state.count.toNumber(), 1);
});
});
What I've tried:
- Re-building and re-deploying the contract successfully on Testnet.
- Hard-refreshing the playground browser environment.
- Running
testdirectly via the playground terminal console.
Despite the successful deployment and complete test script execution, the fetched state counter remains 0. Is there a known state-caching or deployment-sync quirk within Solana Playground that prevents the transaction from reflecting on the account state during test runner execution? Any help would be greatly appreciated!
Top comments (0)