1- import { describe , expect , it , jest } from "@jest/globals "
1+ import { describe , expect , it } from "bun:test "
22import { AbiCoder , ethers , keccak256 , parseEther } from "ethers"
33
44import { account , provider , TEST_TIMEOUT , TX_WAIT_TIMEOUT } from "./setup"
@@ -13,12 +13,10 @@ import {
1313} from "./utils"
1414
1515describe ( "eth queries" , ( ) => {
16- jest . setTimeout ( TEST_TIMEOUT )
17-
1816 it ( "eth_accounts" , async ( ) => {
1917 const accounts = await provider . listAccounts ( )
2018 expect ( accounts ) . not . toBeNull ( )
21- } )
19+ } , TEST_TIMEOUT )
2220
2321 it ( "eth_estimateGas" , async ( ) => {
2422 const tx = {
@@ -29,7 +27,7 @@ describe("eth queries", () => {
2927 const estimatedGas = await provider . estimateGas ( tx )
3028 expect ( estimatedGas ) . toBeGreaterThan ( BigInt ( 0 ) )
3129 expect ( estimatedGas - INTRINSIC_TX_GAS ) . toBeLessThan ( INTRINSIC_TX_GAS / BigInt ( 20 ) )
32- } )
30+ } , TEST_TIMEOUT )
3331
3432 it ( "eth_feeHistory" , async ( ) => {
3533 const blockCount = 5 // Number of blocks in the requested history
@@ -46,18 +44,18 @@ describe("eth queries", () => {
4644 expect ( feeHistory ) . toHaveProperty ( "gasUsedRatio" )
4745 expect ( feeHistory ) . toHaveProperty ( "oldestBlock" )
4846 expect ( feeHistory ) . toHaveProperty ( "reward" )
49- } )
47+ } , TEST_TIMEOUT )
5048
5149 it ( "eth_gasPrice" , async ( ) => {
5250 const gasPrice = await provider . send ( "eth_gasPrice" , [ ] )
5351 expect ( gasPrice ) . toBeDefined ( )
5452 expect ( gasPrice ) . toEqual ( hexify ( 1000000000000 ) ) // 1 micronibi == 10^{12} wei
55- } )
53+ } , TEST_TIMEOUT )
5654
5755 it ( "eth_getBalance" , async ( ) => {
5856 const balance = await provider . getBalance ( account . address )
5957 expect ( balance ) . toBeGreaterThan ( 0 )
60- } )
58+ } , TEST_TIMEOUT )
6159
6260 it ( "eth_getBlockByNumber, eth_getBlockByHash" , async ( ) => {
6361 const blockNumber = "latest"
@@ -75,7 +73,7 @@ describe("eth queries", () => {
7573 expect ( blockByHash ) . toBeDefined ( )
7674 expect ( blockByHash . hash ) . toEqual ( blockByNumber . hash )
7775 expect ( blockByHash . number ) . toEqual ( blockByNumber . number )
78- } )
76+ } , TEST_TIMEOUT )
7977
8078 it ( "eth_getBlockTransactionCountByHash" , async ( ) => {
8179 const blockNumber = "latest"
@@ -87,7 +85,7 @@ describe("eth queries", () => {
8785 block . hash ,
8886 ] )
8987 expect ( parseInt ( txCount ) ) . toBeGreaterThanOrEqual ( 0 )
90- } )
88+ } , TEST_TIMEOUT )
9189
9290 it ( "eth_getBlockTransactionCountByNumber" , async ( ) => {
9391 const blockNumber = "latest"
@@ -96,14 +94,14 @@ describe("eth queries", () => {
9694 [ blockNumber ] ,
9795 )
9896 expect ( parseInt ( txCount ) ) . toBeGreaterThanOrEqual ( 0 )
99- } )
97+ } , TEST_TIMEOUT )
10098
10199 it ( "eth_getCode" , async ( ) => {
102100 const contract = await deployContractSendNibi ( )
103101 const contractAddr = await contract . getAddress ( )
104102 const code = await provider . send ( "eth_getCode" , [ contractAddr , "latest" ] )
105103 expect ( code ) . toBeDefined ( )
106- } )
104+ } , TEST_TIMEOUT )
107105
108106 it ( "eth_getFilterChanges" , async ( ) => {
109107 const currentBlock = await provider . getBlockNumber ( )
@@ -132,7 +130,7 @@ describe("eth queries", () => {
132130
133131 const success = await provider . send ( "eth_uninstallFilter" , [ filterId ] )
134132 expect ( success ) . toBeTruthy ( )
135- } )
133+ } , TEST_TIMEOUT )
136134
137135 it ( "eth_getFilterLogs" , async ( ) => {
138136 const currentBlock = await provider . getBlockNumber ( )
@@ -158,7 +156,7 @@ describe("eth queries", () => {
158156 expect ( changes [ 0 ] ) . toHaveProperty ( "address" )
159157 expect ( changes [ 0 ] ) . toHaveProperty ( "data" )
160158 expect ( changes [ 0 ] ) . toHaveProperty ( "topics" )
161- } )
159+ } , TEST_TIMEOUT )
162160
163161 it ( "eth_getLogs" , async ( ) => {
164162 const currentBlock = await provider . getBlockNumber ( )
@@ -180,7 +178,7 @@ describe("eth queries", () => {
180178 expect ( changes [ 0 ] ) . toHaveProperty ( "address" )
181179 expect ( changes [ 0 ] ) . toHaveProperty ( "data" )
182180 expect ( changes [ 0 ] ) . toHaveProperty ( "topics" )
183- } )
181+ } , TEST_TIMEOUT )
184182
185183 it ( "eth_getProof" , async ( ) => {
186184 // Deploy ERC-20 contract
@@ -211,15 +209,15 @@ describe("eth queries", () => {
211209 expect ( proof . storageProof [ 0 ] ) . toHaveProperty ( "value" )
212210 expect ( proof . storageProof [ 0 ] ) . toHaveProperty ( "proof" )
213211 }
214- } )
212+ } , TEST_TIMEOUT )
215213
216214 it ( "eth_getStorageAt" , async ( ) => {
217215 const contract = await deployContractTestERC20 ( )
218216 const contractAddr = await contract . getAddress ( )
219217
220218 const value = await provider . getStorage ( contractAddr , 1 )
221219 expect ( value ) . toBeDefined ( )
222- } )
220+ } , TEST_TIMEOUT )
223221
224222 it ( "eth_getTransactionByBlockHashAndIndex, eth_getTransactionByBlockNumberAndIndex" , async ( ) => {
225223 // Execute EVM transfer
@@ -246,26 +244,26 @@ describe("eth queries", () => {
246244 expect ( txByBlockNumber [ "from" ] ) . toEqual ( txByBlockHash [ "from" ] )
247245 expect ( txByBlockNumber [ "to" ] ) . toEqual ( txByBlockHash [ "to" ] )
248246 expect ( txByBlockNumber [ "value" ] ) . toEqual ( txByBlockHash [ "value" ] )
249- } )
247+ } , TEST_TIMEOUT )
250248
251249 it ( "eth_getTransactionByHash" , async ( ) => {
252250 const txResponse = await sendTestNibi ( )
253251 const txByHash = await provider . getTransaction ( txResponse . hash )
254252 expect ( txByHash ) . toBeDefined ( )
255253 expect ( txByHash . hash ) . toEqual ( txResponse . hash )
256- } )
254+ } , TEST_TIMEOUT )
257255
258256 it ( "eth_getTransactionCount" , async ( ) => {
259257 const txCount = await provider . getTransactionCount ( account . address )
260258 expect ( txCount ) . toBeGreaterThanOrEqual ( 0 )
261- } )
259+ } , TEST_TIMEOUT )
262260
263261 it ( "eth_getTransactionReceipt" , async ( ) => {
264262 const txResponse = await sendTestNibi ( )
265263 const txReceipt = await provider . getTransactionReceipt ( txResponse . hash )
266264 expect ( txReceipt ) . toBeDefined ( )
267265 expect ( txReceipt . hash ) . toEqual ( txResponse . hash )
268- } )
266+ } , TEST_TIMEOUT )
269267
270268 it ( "eth_getUncleCountByBlockHash" , async ( ) => {
271269 const latestBlock = await provider . getBlockNumber ( )
@@ -274,33 +272,33 @@ describe("eth queries", () => {
274272 block . hash ,
275273 ] )
276274 expect ( parseInt ( uncleCount ) ) . toBeGreaterThanOrEqual ( 0 )
277- } )
275+ } , TEST_TIMEOUT )
278276
279277 it ( "eth_getUncleCountByBlockNumber" , async ( ) => {
280278 const latestBlock = await provider . getBlockNumber ( )
281279 const uncleCount = await provider . send ( "eth_getUncleCountByBlockNumber" , [
282280 latestBlock ,
283281 ] )
284282 expect ( parseInt ( uncleCount ) ) . toBeGreaterThanOrEqual ( 0 )
285- } )
283+ } , TEST_TIMEOUT )
286284
287285 it ( "eth_maxPriorityFeePerGas" , async ( ) => {
288286 const maxPriorityGas = await provider . send ( "eth_maxPriorityFeePerGas" , [ ] )
289287 expect ( parseInt ( maxPriorityGas ) ) . toBeGreaterThanOrEqual ( 0 )
290- } )
288+ } , TEST_TIMEOUT )
291289
292290 it ( "eth_newBlockFilter" , async ( ) => {
293291 const filterId = await provider . send ( "eth_newBlockFilter" , [ ] )
294292 expect ( filterId ) . toBeDefined ( )
295- } )
293+ } , TEST_TIMEOUT )
296294
297295 it ( "eth_newPendingTransactionFilter" , async ( ) => {
298296 const filterId = await provider . send ( "eth_newPendingTransactionFilter" , [ ] )
299297 expect ( filterId ) . toBeDefined ( )
300- } )
298+ } , TEST_TIMEOUT )
301299
302300 it ( "eth_syncing" , async ( ) => {
303301 const syncing = await provider . send ( "eth_syncing" , [ ] )
304302 expect ( syncing ) . toBeFalsy ( )
305- } )
303+ } , TEST_TIMEOUT )
306304} )
0 commit comments