Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit 95de1c7

Browse files
committed
lint fix
1 parent 50f18b5 commit 95de1c7

File tree

3 files changed

+28
-28
lines changed

3 files changed

+28
-28
lines changed

packages/web3-eth/test/integration/format.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { SupportedProviders, FMT_BYTES, FMT_NUMBER, DEFAULT_RETURN_FORMAT } from
2020
import { Contract } from 'web3-eth-contract';
2121
import { numberToHex } from 'web3-utils';
2222
// eslint-disable-next-line import/no-extraneous-dependencies
23+
import { describe } from 'node:test';
2324
import { Web3Eth } from '../../src';
2425

2526
import {
@@ -30,7 +31,6 @@ import {
3031
mapFormatToType,
3132
} from '../fixtures/system_test_utils';
3233
import { BasicAbi, BasicBytecode } from '../shared_fixtures/build/Basic';
33-
import { describe } from 'node:test';
3434

3535
describe('format', () => {
3636
let web3Eth: Web3Eth;
@@ -71,21 +71,21 @@ describe('format', () => {
7171
});
7272

7373
describe('methods', () => {
74-
it.each(Object.values(FMT_NUMBER))('getBlockNumber', async format => {
74+
test.each(Object.values(FMT_NUMBER))('getBlockNumber', async format => {
7575
web3Eth.defaultReturnFormat = { number: format as FMT_NUMBER, bytes: FMT_BYTES.HEX };
7676
const res = await web3Eth.getBlockNumber();
7777
expect(typeof res).toBe(mapFormatToType[format as string]);
7878
expect(parseInt(String(res), 16)).toBeGreaterThan(0);
7979
});
8080

81-
it.each(Object.values(FMT_NUMBER))('getGasPrice', async format => {
81+
test.each(Object.values(FMT_NUMBER))('getGasPrice', async format => {
8282
web3Eth.defaultReturnFormat = { number: format as FMT_NUMBER, bytes: FMT_BYTES.HEX };
8383
const res = await web3Eth.getGasPrice();
8484
expect(typeof res).toBe(mapFormatToType[format as string]);
8585
expect(parseInt(String(res), 16)).toBeGreaterThan(0);
8686
});
8787

88-
it.each(Object.values(FMT_NUMBER))('getBalance', async format => {
88+
test.each(Object.values(FMT_NUMBER))('getBalance', async format => {
8989
web3Eth.defaultReturnFormat = { number: format as FMT_NUMBER, bytes: FMT_BYTES.HEX };
9090
const value = '0xa';
9191
const newAccount = await createNewAccount();
@@ -99,14 +99,14 @@ describe('format', () => {
9999
expect(numberToHex(res)).toBe(value);
100100
});
101101

102-
it.each(Object.values(FMT_BYTES))('getCode', async format => {
102+
test.each(Object.values(FMT_BYTES))('getCode', async format => {
103103
web3Eth.defaultReturnFormat = { number: FMT_NUMBER.BIGINT, bytes: format };
104104
const code = await web3Eth.getCode(contractDeployed?.options?.address as string);
105105
expect(code).toBeDefined();
106106
expect(typeof code).toBe(mapFormatToType[format as string]);
107107
});
108108

109-
it.each(Object.values(FMT_NUMBER))('getChainId', async format => {
109+
test.each(Object.values(FMT_NUMBER))('getChainId', async format => {
110110
web3Eth.defaultReturnFormat = { number: format as FMT_NUMBER, bytes: FMT_BYTES.HEX };
111111
const res = await web3Eth.getChainId();
112112
expect(typeof res).toBe(mapFormatToType[format as string]);

packages/web3-eth/test/integration/rpc.test.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
import { Contract, decodeEventABI } from 'web3-eth-contract';
2828
import { hexToNumber, hexToString, numberToHex, getStorageSlotNumForLongString } from 'web3-utils';
2929
// eslint-disable-next-line import/no-extraneous-dependencies
30+
import { describe } from 'node:test';
3031
import { Web3Eth } from '../../src';
3132

3233
import {
@@ -42,7 +43,6 @@ import {
4243
} from '../fixtures/system_test_utils';
4344
import { BasicAbi, BasicBytecode } from '../shared_fixtures/build/Basic';
4445
import { eventAbi, sendFewTxes, validateReceipt, validateTransaction } from './helper';
45-
import { describe } from 'node:test';
4646

4747
describe('rpc', () => {
4848
let web3Eth: Web3Eth;
@@ -92,13 +92,13 @@ describe('rpc', () => {
9292
);
9393

9494
// TODO:in beta, test eth_syncing during sync mode with return obj having ( startingblock, currentBlock, heighestBlock )
95-
it('isSyncing', async () => {
95+
test('isSyncing', async () => {
9696
const isSyncing = await web3Eth.isSyncing();
9797
expect(isSyncing).toBe(false);
9898
});
9999

100100
// TODO: in future release, set coinbase account in node and match actual address here
101-
it('getCoinbase', async () => {
101+
test('getCoinbase', async () => {
102102
const coinbase = await web3Eth.getCoinbase();
103103
expect(coinbase.startsWith('0x')).toBe(true);
104104
expect(coinbase).toHaveLength(42);
@@ -113,7 +113,7 @@ describe('rpc', () => {
113113
});
114114

115115
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 => {
117117
const hashRate = await web3Eth.getHashRate({
118118
number: format as FMT_NUMBER,
119119
bytes: FMT_BYTES.HEX,
@@ -123,7 +123,7 @@ describe('rpc', () => {
123123
});
124124
});
125125

126-
it('getAccounts', async () => {
126+
test('getAccounts', async () => {
127127
// hardhat does not have support importrawkey, so we can't add new accounts rather just check the default 20 accounts
128128
if (getSystemTestBackend() !== BACKEND.HARDHAT) {
129129
const account = await createNewAccount({ unlock: true });
@@ -138,7 +138,7 @@ describe('rpc', () => {
138138
}
139139
});
140140

141-
it.each(Object.values(FMT_NUMBER))('getBlockNumber', async format => {
141+
test.each(Object.values(FMT_NUMBER))('getBlockNumber', async format => {
142142
const res = await web3Eth.getBlockNumber({
143143
number: format as FMT_NUMBER,
144144
bytes: FMT_BYTES.HEX,
@@ -147,7 +147,7 @@ describe('rpc', () => {
147147
expect(parseInt(String(res), 16)).toBeGreaterThan(0);
148148
});
149149

150-
it.each(Object.values(FMT_NUMBER))('getGasPrice', async format => {
150+
test.each(Object.values(FMT_NUMBER))('getGasPrice', async format => {
151151
const res = await web3Eth.getGasPrice({
152152
number: format as FMT_NUMBER,
153153
bytes: FMT_BYTES.HEX,
@@ -156,7 +156,7 @@ describe('rpc', () => {
156156
expect(parseInt(String(res), 16)).toBeGreaterThan(0);
157157
});
158158

159-
it.each(Object.values(FMT_NUMBER))('getBalance', async format => {
159+
test.each(Object.values(FMT_NUMBER))('getBalance', async format => {
160160
const value = '0xa';
161161
const newAccount = await createNewAccount();
162162
await web3Eth.sendTransaction({
@@ -173,7 +173,7 @@ describe('rpc', () => {
173173
expect(numberToHex(res)).toBe(value);
174174
});
175175

176-
it('getStorageAt', async () => {
176+
test('getStorageAt', async () => {
177177
const numberData = 10;
178178
const stringData = 'str';
179179
const boolData = true;
@@ -247,7 +247,7 @@ describe('rpc', () => {
247247
expect(stringDataLong).toBe(str);
248248
});
249249

250-
it.each(Object.values(FMT_NUMBER))('getCode', async format => {
250+
test.each(Object.values(FMT_NUMBER))('getCode', async format => {
251251
const code = await web3Eth.getCode(
252252
contractDeployed?.options?.address as string,
253253
undefined,
@@ -260,7 +260,7 @@ describe('rpc', () => {
260260
expect(BasicBytecode.slice(-100)).toBe(code.slice(-100));
261261
});
262262

263-
it('getTransaction', async () => {
263+
test('getTransaction', async () => {
264264
const [receipt] = await sendFewTxes({
265265
from: tempAcc.address,
266266
value: '0x1',
@@ -276,7 +276,7 @@ describe('rpc', () => {
276276
validateTransaction(res as TransactionInfo);
277277
expect(res?.hash).toBe(receipt.transactionHash);
278278
});
279-
it('check get transaction fields', async () => {
279+
test('check get transaction fields', async () => {
280280
const receipt0 = await web3Eth.sendTransaction({
281281
from: tempAcc.address,
282282
value: '0x1',
@@ -375,7 +375,7 @@ describe('rpc', () => {
375375
expect(res).toBeDefined();
376376
});
377377

378-
it('getTransactionReceipt', async () => {
378+
test('getTransactionReceipt', async () => {
379379
const [receipt] = await sendFewTxes({
380380
from: tempAcc.address,
381381
value: '0x1',
@@ -390,7 +390,7 @@ describe('rpc', () => {
390390
expect(res?.transactionHash).toBe(receipt.transactionHash);
391391
});
392392

393-
it('getChainId', async () => {
393+
test('getChainId', async () => {
394394
const res = await web3Eth.getChainId({
395395
number: FMT_NUMBER.NUMBER,
396396
bytes: FMT_BYTES.HEX,
@@ -399,7 +399,7 @@ describe('rpc', () => {
399399
expect(Number(res)).toBeGreaterThan(0);
400400
});
401401

402-
it('getNodeInfo', async () => {
402+
test('getNodeInfo', async () => {
403403
const res = await web3Eth.getNodeInfo();
404404
// TODO: in next release, it should also be validated
405405
expect(res).toBeDefined();
@@ -432,7 +432,7 @@ describe('rpc', () => {
432432
expect(res.storageProof[0].value).toBe(numberData);
433433
});
434434

435-
it('getPastLogs', async () => {
435+
test('getPastLogs', async () => {
436436
const listOfStrings = ['t1', 't2', 't3'];
437437
const resTx = [];
438438
for (const l of listOfStrings) {

packages/web3/test/integration/web3.format.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ along with web3.js. If not, see <http://www.gnu.org/licenses/>.
1717

1818
import { SupportedProviders, FMT_BYTES, FMT_NUMBER, DEFAULT_RETURN_FORMAT } from 'web3-types';
1919
import { numberToHex } from 'web3-utils';
20+
import { describe } from 'node:test';
2021
import { Web3, Contract } from '../../src';
2122

2223
import {
@@ -27,7 +28,6 @@ import {
2728
mapFormatToType,
2829
} from '../shared_fixtures/system_tests_utils';
2930
import { BasicAbi, BasicBytecode } from '../shared_fixtures/build/Basic';
30-
import { describe } from 'node:test';
3131

3232
describe('format', () => {
3333
let web3: Web3;
@@ -65,21 +65,21 @@ describe('format', () => {
6565
});
6666

6767
describe('methods', () => {
68-
it.each(Object.values(FMT_NUMBER))('getBlockNumber', async format => {
68+
test.each(Object.values(FMT_NUMBER))('getBlockNumber', async format => {
6969
web3.defaultReturnFormat = { number: format as FMT_NUMBER, bytes: FMT_BYTES.HEX };
7070
const res = await web3.eth.getBlockNumber();
7171
expect(typeof res).toBe(mapFormatToType[format as string]);
7272
expect(parseInt(String(res), 16)).toBeGreaterThan(0);
7373
});
7474

75-
it.each(Object.values(FMT_NUMBER))('getGasPrice', async format => {
75+
test.each(Object.values(FMT_NUMBER))('getGasPrice', async format => {
7676
web3.defaultReturnFormat = { number: format as FMT_NUMBER, bytes: FMT_BYTES.HEX };
7777
const res = await web3.eth.getGasPrice();
7878
expect(typeof res).toBe(mapFormatToType[format as string]);
7979
expect(parseInt(String(res), 16)).toBeGreaterThan(0);
8080
});
8181

82-
it.each(Object.values(FMT_NUMBER))('getBalance', async format => {
82+
test.each(Object.values(FMT_NUMBER))('getBalance', async format => {
8383
web3.defaultReturnFormat = { number: format as FMT_NUMBER, bytes: FMT_BYTES.HEX };
8484
const value = '0xa';
8585
const newAccount = await createNewAccount();
@@ -93,14 +93,14 @@ describe('format', () => {
9393
expect(numberToHex(res)).toBe(value);
9494
});
9595

96-
it.each(Object.values(FMT_BYTES))('getCode', async format => {
96+
test.each(Object.values(FMT_BYTES))('getCode', async format => {
9797
web3.defaultReturnFormat = { number: FMT_NUMBER.BIGINT, bytes: format };
9898
const code = await web3.eth.getCode(contractDeployed?.options?.address as string);
9999
expect(code).toBeDefined();
100100
expect(typeof code).toBe(mapFormatToType[format as string]);
101101
});
102102

103-
it.each(Object.values(FMT_NUMBER))('getChainId', async format => {
103+
test.each(Object.values(FMT_NUMBER))('getChainId', async format => {
104104
web3.defaultReturnFormat = { number: format as FMT_NUMBER, bytes: FMT_BYTES.HEX };
105105

106106
const res = await web3.eth.getChainId();

0 commit comments

Comments
 (0)