Skip to content

Commit bf3c079

Browse files
author
tilo-14
committed
Revert counter test changes
1 parent 016b6b4 commit bf3c079

1 file changed

Lines changed: 19 additions & 18 deletions

File tree

‎counter/anchor/tests/test.ts‎

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
Rpc,
1515
sleep,
1616
} from "@lightprotocol/stateless.js";
17+
import { assert } from "chai";
1718

1819
const path = require("path");
1920
const os = require("os");
@@ -60,9 +61,8 @@ describe("test-anchor", () => {
6061
outputMerkleTree,
6162
signer
6263
);
63-
// Wait for indexer to process the create transaction
64-
let slot = await rpc.getSlot();
65-
await rpc.confirmTransactionIndexed(slot);
64+
// Wait for indexer to catch up.
65+
await sleep(2000);
6666

6767
let counterAccount = await rpc.getCompressedAccount(bn(address.toBytes()));
6868

@@ -82,15 +82,11 @@ describe("test-anchor", () => {
8282
signer
8383
);
8484

85-
// Wait for indexer to process the increment transaction
86-
slot = await rpc.getSlot();
87-
await rpc.confirmTransactionIndexed(slot);
85+
// Wait for indexer to catch up.
86+
await sleep(2000);
8887

8988
counterAccount = await rpc.getCompressedAccount(bn(address.toBytes()));
90-
counter = coder.types.decode(
91-
"CounterAccount",
92-
counterAccount.data.data
93-
);
89+
counter = coder.types.decode("CounterAccount", counterAccount.data.data);
9490
console.log("counter account ", counterAccount);
9591
console.log("des counter ", counter);
9692

@@ -103,14 +99,19 @@ describe("test-anchor", () => {
10399
signer
104100
);
105101

106-
// Wait for indexer to process the delete transaction
107-
slot = await rpc.getSlot();
108-
await rpc.confirmTransactionIndexed(slot);
109-
110-
const deletedCounterAccount = await rpc.getCompressedAccount(
111-
bn(address.toBytes())
112-
);
113-
console.log("deletedCounterAccount ", deletedCounterAccount);
102+
// Wait for indexer to catch up.
103+
await sleep(2000);
104+
let should_have_failed = false;
105+
try {
106+
const deletedCounterAccount = await rpc.getCompressedAccount(
107+
bn(address.toBytes())
108+
);
109+
console.log("deletedCounterAccount ", deletedCounterAccount);
110+
} catch (e) {
111+
should_have_failed = true;
112+
}
113+
// TODO: assert is Null after next update.
114+
assert.isTrue(should_have_failed);
114115
});
115116
});
116117

0 commit comments

Comments
 (0)