-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
96c42c7
commit 3ed7108
Showing
2 changed files
with
28 additions
and
6 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
packages/eth-rpc-adapter/src/__tests__/endpoint-tests/eth_getBlockByNumber.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { describe, expect, it } from 'vitest'; | ||
|
||
import { deployErc20, eth_getBlockByNumber, testSetup } from '../utils'; | ||
|
||
const { wallet, provider } = testSetup; | ||
|
||
describe('eth_getBlockByNumber', () => { | ||
it('get correct block info', async () => { | ||
const token = await deployErc20(wallet); | ||
const txHash = token.deployTransaction.hash; | ||
|
||
const curBlockNumber = await provider.getBlockNumber(); | ||
|
||
const res = (await eth_getBlockByNumber([curBlockNumber, false])).data.result; | ||
const resFull = (await eth_getBlockByNumber([curBlockNumber, true])).data.result; | ||
|
||
expect(Number(res.number)).toEqual(curBlockNumber); | ||
expect(res.transactions[0]).to.eq(txHash); | ||
|
||
expect(Number(resFull.number)).toEqual(curBlockNumber); | ||
expect(resFull.transactions[0]).to.contain({ | ||
hash: txHash, | ||
from: wallet.address.toLowerCase(), | ||
to: null, | ||
value: '0x0', | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters