@@ -27,6 +27,7 @@ import {
27
27
import { Contract , decodeEventABI } from 'web3-eth-contract' ;
28
28
import { hexToNumber , hexToString , numberToHex , getStorageSlotNumForLongString } from 'web3-utils' ;
29
29
// eslint-disable-next-line import/no-extraneous-dependencies
30
+ import { describe } from 'node:test' ;
30
31
import { Web3Eth } from '../../src' ;
31
32
32
33
import {
@@ -42,7 +43,6 @@ import {
42
43
} from '../fixtures/system_test_utils' ;
43
44
import { BasicAbi , BasicBytecode } from '../shared_fixtures/build/Basic' ;
44
45
import { eventAbi , sendFewTxes , validateReceipt , validateTransaction } from './helper' ;
45
- import { describe } from 'node:test' ;
46
46
47
47
describe ( 'rpc' , ( ) => {
48
48
let web3Eth : Web3Eth ;
@@ -92,13 +92,13 @@ describe('rpc', () => {
92
92
) ;
93
93
94
94
// TODO:in beta, test eth_syncing during sync mode with return obj having ( startingblock, currentBlock, heighestBlock )
95
- it ( 'isSyncing' , async ( ) => {
95
+ test ( 'isSyncing' , async ( ) => {
96
96
const isSyncing = await web3Eth . isSyncing ( ) ;
97
97
expect ( isSyncing ) . toBe ( false ) ;
98
98
} ) ;
99
99
100
100
// TODO: in future release, set coinbase account in node and match actual address here
101
- it ( 'getCoinbase' , async ( ) => {
101
+ test ( 'getCoinbase' , async ( ) => {
102
102
const coinbase = await web3Eth . getCoinbase ( ) ;
103
103
expect ( coinbase . startsWith ( '0x' ) ) . toBe ( true ) ;
104
104
expect ( coinbase ) . toHaveLength ( 42 ) ;
@@ -113,7 +113,7 @@ describe('rpc', () => {
113
113
} ) ;
114
114
115
115
describeIf ( getSystemTestBackend ( ) !== BACKEND . HARDHAT ) ( 'getHashRate' , ( ) => {
116
- it . each ( Object . values ( FMT_NUMBER ) ) ( 'getHashRate' , async format => {
116
+ test . each ( Object . values ( FMT_NUMBER ) ) ( 'getHashRate' , async format => {
117
117
const hashRate = await web3Eth . getHashRate ( {
118
118
number : format as FMT_NUMBER ,
119
119
bytes : FMT_BYTES . HEX ,
@@ -123,7 +123,7 @@ describe('rpc', () => {
123
123
} ) ;
124
124
} ) ;
125
125
126
- it ( 'getAccounts' , async ( ) => {
126
+ test ( 'getAccounts' , async ( ) => {
127
127
// hardhat does not have support importrawkey, so we can't add new accounts rather just check the default 20 accounts
128
128
if ( getSystemTestBackend ( ) !== BACKEND . HARDHAT ) {
129
129
const account = await createNewAccount ( { unlock : true } ) ;
@@ -138,7 +138,7 @@ describe('rpc', () => {
138
138
}
139
139
} ) ;
140
140
141
- it . each ( Object . values ( FMT_NUMBER ) ) ( 'getBlockNumber' , async format => {
141
+ test . each ( Object . values ( FMT_NUMBER ) ) ( 'getBlockNumber' , async format => {
142
142
const res = await web3Eth . getBlockNumber ( {
143
143
number : format as FMT_NUMBER ,
144
144
bytes : FMT_BYTES . HEX ,
@@ -147,7 +147,7 @@ describe('rpc', () => {
147
147
expect ( parseInt ( String ( res ) , 16 ) ) . toBeGreaterThan ( 0 ) ;
148
148
} ) ;
149
149
150
- it . each ( Object . values ( FMT_NUMBER ) ) ( 'getGasPrice' , async format => {
150
+ test . each ( Object . values ( FMT_NUMBER ) ) ( 'getGasPrice' , async format => {
151
151
const res = await web3Eth . getGasPrice ( {
152
152
number : format as FMT_NUMBER ,
153
153
bytes : FMT_BYTES . HEX ,
@@ -156,7 +156,7 @@ describe('rpc', () => {
156
156
expect ( parseInt ( String ( res ) , 16 ) ) . toBeGreaterThan ( 0 ) ;
157
157
} ) ;
158
158
159
- it . each ( Object . values ( FMT_NUMBER ) ) ( 'getBalance' , async format => {
159
+ test . each ( Object . values ( FMT_NUMBER ) ) ( 'getBalance' , async format => {
160
160
const value = '0xa' ;
161
161
const newAccount = await createNewAccount ( ) ;
162
162
await web3Eth . sendTransaction ( {
@@ -173,7 +173,7 @@ describe('rpc', () => {
173
173
expect ( numberToHex ( res ) ) . toBe ( value ) ;
174
174
} ) ;
175
175
176
- it ( 'getStorageAt' , async ( ) => {
176
+ test ( 'getStorageAt' , async ( ) => {
177
177
const numberData = 10 ;
178
178
const stringData = 'str' ;
179
179
const boolData = true ;
@@ -247,7 +247,7 @@ describe('rpc', () => {
247
247
expect ( stringDataLong ) . toBe ( str ) ;
248
248
} ) ;
249
249
250
- it . each ( Object . values ( FMT_NUMBER ) ) ( 'getCode' , async format => {
250
+ test . each ( Object . values ( FMT_NUMBER ) ) ( 'getCode' , async format => {
251
251
const code = await web3Eth . getCode (
252
252
contractDeployed ?. options ?. address as string ,
253
253
undefined ,
@@ -260,7 +260,7 @@ describe('rpc', () => {
260
260
expect ( BasicBytecode . slice ( - 100 ) ) . toBe ( code . slice ( - 100 ) ) ;
261
261
} ) ;
262
262
263
- it ( 'getTransaction' , async ( ) => {
263
+ test ( 'getTransaction' , async ( ) => {
264
264
const [ receipt ] = await sendFewTxes ( {
265
265
from : tempAcc . address ,
266
266
value : '0x1' ,
@@ -276,7 +276,7 @@ describe('rpc', () => {
276
276
validateTransaction ( res as TransactionInfo ) ;
277
277
expect ( res ?. hash ) . toBe ( receipt . transactionHash ) ;
278
278
} ) ;
279
- it ( 'check get transaction fields' , async ( ) => {
279
+ test ( 'check get transaction fields' , async ( ) => {
280
280
const receipt0 = await web3Eth . sendTransaction ( {
281
281
from : tempAcc . address ,
282
282
value : '0x1' ,
@@ -375,7 +375,7 @@ describe('rpc', () => {
375
375
expect ( res ) . toBeDefined ( ) ;
376
376
} ) ;
377
377
378
- it ( 'getTransactionReceipt' , async ( ) => {
378
+ test ( 'getTransactionReceipt' , async ( ) => {
379
379
const [ receipt ] = await sendFewTxes ( {
380
380
from : tempAcc . address ,
381
381
value : '0x1' ,
@@ -390,7 +390,7 @@ describe('rpc', () => {
390
390
expect ( res ?. transactionHash ) . toBe ( receipt . transactionHash ) ;
391
391
} ) ;
392
392
393
- it ( 'getChainId' , async ( ) => {
393
+ test ( 'getChainId' , async ( ) => {
394
394
const res = await web3Eth . getChainId ( {
395
395
number : FMT_NUMBER . NUMBER ,
396
396
bytes : FMT_BYTES . HEX ,
@@ -399,7 +399,7 @@ describe('rpc', () => {
399
399
expect ( Number ( res ) ) . toBeGreaterThan ( 0 ) ;
400
400
} ) ;
401
401
402
- it ( 'getNodeInfo' , async ( ) => {
402
+ test ( 'getNodeInfo' , async ( ) => {
403
403
const res = await web3Eth . getNodeInfo ( ) ;
404
404
// TODO: in next release, it should also be validated
405
405
expect ( res ) . toBeDefined ( ) ;
@@ -432,7 +432,7 @@ describe('rpc', () => {
432
432
expect ( res . storageProof [ 0 ] . value ) . toBe ( numberData ) ;
433
433
} ) ;
434
434
435
- it ( 'getPastLogs' , async ( ) => {
435
+ test ( 'getPastLogs' , async ( ) => {
436
436
const listOfStrings = [ 't1' , 't2' , 't3' ] ;
437
437
const resTx = [ ] ;
438
438
for ( const l of listOfStrings ) {
0 commit comments