Skip to content

Commit

Permalink
Update the test
Browse files Browse the repository at this point in the history
  • Loading branch information
boundless-forest committed Aug 16, 2023
1 parent 331dc12 commit 924a709
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions ts-tests/tests/test-block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,18 +240,26 @@ describeWithFrontier("Frontier RPC (BlockReceipts)", (context) => {
});

it("should support block number, tag and hash", async function () {
expect(await context.web3.eth.getBlockNumber()).to.equal(2);
let block_number = await context.web3.eth.getBlockNumber();

// block number
expect((await customRequest(context.web3, "eth_getBlockReceipts", [2])).result.length).to.be.eq(N);
expect((await customRequest(context.web3, "eth_getBlockReceipts", [block_number])).result.length).to.be.eq(N);
// block hash
let block = await context.web3.eth.getBlock(2);
let result = await customRequest(context.web3, "eth_getBlockReceipts", [block.hash, true]);
console.log("result", result);
// expect((await customRequest(context.web3, "eth_getBlockReceipts", [block.hash])).result.length).to.be.eq(N);
let block = await context.web3.eth.getBlock(block_number);
expect(
(
await customRequest(context.web3, "eth_getBlockReceipts", [
{
blockHash: block.hash,
requireCanonical: true,
},
])
).result.length
).to.be.eq(N);
// block tags
expect((await customRequest(context.web3, "eth_getBlockReceipts", ["earliest"])).result.length).to.be.eq(0);
expect((await customRequest(context.web3, "eth_getBlockReceipts", ["pending"])).result.length).to.be.eq(0);
expect((await customRequest(context.web3, "eth_getBlockReceipts", ["finalized"])).result.length).to.be.eq(N);
expect((await customRequest(context.web3, "eth_getBlockReceipts", ["latest"])).result.length).to.be.eq(N);
});
});

0 comments on commit 924a709

Please sign in to comment.