Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
shunjizhan committed Jan 22, 2024
1 parent 08d3174 commit 5d973f0
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,55 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`endpoint > eth_getBlockByNumber > for very old runtime 1`] = `
{
"difficulty": "0x0",
"extraData": "0x",
"gasLimit": "0x1c99c80",
"gasUsed": "0x0",
"hash": "0x000643ffd6bbb04682ae1675e2e478e4c8ecd7c7b9d7e9d1eafe1b6095f751e3",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"miner": "0x8ce1cab8e0d55252720728bc495d05841ea3dc23",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"nonce": "0x0000000000000000",
"number": "0x5ae2c",
"parentHash": "0xe2ebe9eb139f9bc88862615f6a0c5095417595a0f80bd4f7f94c1c3753499973",
"receiptsRoot": "0xd3596ebbbb67ac571735047e856cecb63f3d8a519af4699ecc4505de59d570e5",
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"size": "0xa80",
"stateRoot": "0xd440bfe07178304657083255758ec74358a3ed592720a8484015d1d89950e81e",
"timestamp": "0x611f2b1e",
"totalDifficulty": "0x0",
"transactions": [],
"transactionsRoot": "0xd3596ebbbb67ac571735047e856cecb63f3d8a519af4699ecc4505de59d570e5",
"uncles": [],
}
`;

exports[`endpoint > eth_getBlockByNumber > for very old runtime 2`] = `
{
"difficulty": "0x0",
"extraData": "0x",
"gasLimit": "0x1c99c80",
"gasUsed": "0x0",
"hash": "0x000643ffd6bbb04682ae1675e2e478e4c8ecd7c7b9d7e9d1eafe1b6095f751e3",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"miner": "0x8ce1cab8e0d55252720728bc495d05841ea3dc23",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"nonce": "0x0000000000000000",
"number": "0x5ae2c",
"parentHash": "0xe2ebe9eb139f9bc88862615f6a0c5095417595a0f80bd4f7f94c1c3753499973",
"receiptsRoot": "0xd3596ebbbb67ac571735047e856cecb63f3d8a519af4699ecc4505de59d570e5",
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"size": "0xa80",
"stateRoot": "0xd440bfe07178304657083255758ec74358a3ed592720a8484015d1d89950e81e",
"timestamp": "0x611f2b1e",
"totalDifficulty": "0x0",
"transactions": [],
"transactionsRoot": "0xd3596ebbbb67ac571735047e856cecb63f3d8a519af4699ecc4505de59d570e5",
"uncles": [],
}
`;

exports[`endpoint > eth_getBlockByNumber > when there are >= 2 EVM transactions 1`] = `
{
"difficulty": "0x0",
Expand Down
8 changes: 8 additions & 0 deletions packages/eth-rpc-adapter/src/__tests__/e2e/endpoint.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1238,6 +1238,14 @@ describe('endpoint', () => {
expect(resFull).toMatchSnapshot();
expect(res).toMatchSnapshot();
});

it('for very old runtime', async () => {
const resFull = (await eth_getBlockByNumber_karura([372268, true])).data.result;
const res = (await eth_getBlockByNumber_karura([372268, false])).data.result;

expect(resFull).toMatchSnapshot();
expect(res).toMatchSnapshot();
});
});

describe('eth_getBalance', () => {
Expand Down

0 comments on commit 5d973f0

Please sign in to comment.