Skip to content

Commit 65b78dd

Browse files
authored
chore: fix-1826 (#1835)
1 parent 1198b31 commit 65b78dd

File tree

4 files changed

+25
-27
lines changed

4 files changed

+25
-27
lines changed

packages/network/jest.config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/** @type {import('ts-jest').JestConfigWithTsJest} */
22
// Coverage threshold would apply to yarn test, not yarn test:unit
3-
const isUnitTest = process.env.UNIT;
3+
const applyCodeCoverageLimits = process.env.APPLYCODECOVLIMITS;
44

55
module.exports = {
66
preset: 'ts-jest',
@@ -10,7 +10,7 @@ module.exports = {
1010
reporters: ['default', 'jest-junit'],
1111
workerThreads: true,
1212
coverageThreshold:
13-
isUnitTest !== 'true'
13+
applyCodeCoverageLimits == 'true'
1414
? {
1515
global: {
1616
branches: 98,

packages/network/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@
3232
"format": "prettier --write src/**/*.ts tests/**/*.ts solo-seeding/**/*.ts",
3333
"start-thor-solo": "echo 'Starting thor solo node ...' && docker compose -f ../../docker-compose.thor.yml up -d --wait && echo '\nThor solo node started ...'",
3434
"stop-thor-solo": "echo 'Stopping thor solo node ...' && docker compose -f ../../docker-compose.thor.yml down && echo 'Thor solo node stopped ...'",
35-
"test:unit": "rm -rf ./coverageUnit && UNIT=true jest --coverage --coverageDirectory=coverageUnit --group=unit",
36-
"test:integration": "rm -rf ./coverageIntegration && jest --coverage --coverageDirectory=coverageIntegration --group=integration",
37-
"test:integration:solo": "(yarn start-thor-solo && yarn test:integration && yarn stop-thor-solo) || yarn stop-thor-solo",
35+
"test:unit": "rm -rf ./coverageUnit && APPLYCODECOVLIMITS=true jest --coverage --coverageDirectory=coverageUnit --group=unit",
36+
"test:integration": "rm -rf ./coverageIntegration && APPLYCODECOVLIMITS=false jest --coverage --coverageDirectory=coverageIntegration --group=integration",
37+
"test:integration:solo": "APPLYCODECOVLIMITS=false yarn start-thor-solo && yarn test:integration && yarn stop-thor-solo || yarn stop-thor-solo",
3838
"test:browser": "rm -rf ./coverage && jest --coverage --coverageDirectory=coverage --group=integration --group=unit --config ./jest.config.browser.js",
39-
"test": "rm -rf ./coverage && jest --coverage --coverageDirectory=coverage --group=integration --group=unit",
39+
"test": "rm -rf ./coverage && APPLYCODECOVLIMITS=true jest --coverage --coverageDirectory=coverage --group=integration --group=unit",
4040
"test:solo": "(yarn start-thor-solo && yarn test && yarn stop-thor-solo) || yarn stop-thor-solo",
4141
"test:browser:solo": "(yarn start-thor-solo && yarn test:browser && yarn stop-thor-solo) || yarn stop-thor-solo"
4242
},

packages/network/src/provider/utils/rpc-mapper/methods/eth_estimateGas/eth_estimateGas.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const ethEstimateGas = async (
5252
{
5353
to: inputOptions.to ?? null,
5454
value: inputOptions.value ?? '0x0',
55-
data: inputOptions.data ?? '0x0'
55+
data: inputOptions.data ?? '0x'
5656
} satisfies SimulateTransactionClause
5757
],
5858
inputOptions.from,
@@ -62,7 +62,7 @@ const ethEstimateGas = async (
6262
);
6363

6464
// Convert intrinsic gas to hex string and return
65-
return await Promise.resolve('0x' + estimatedGas.totalGas.toString(16));
65+
return '0x' + estimatedGas.totalGas.toString(16);
6666
} catch (e) {
6767
throw new JSONRPCInternalError(
6868
'eth_estimateGas()',

packages/network/tests/provider/rpc-mapper/methods/eth_estimateGas/fixture.ts

+17-19
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import { Address, Clause, VET } from '@vechain/sdk-core';
2-
import {
3-
JSONRPCInternalError,
4-
JSONRPCInvalidParams
5-
} from '@vechain/sdk-errors';
1+
import { JSONRPCInvalidParams } from '@vechain/sdk-errors';
62

73
/**
84
* Fixtures for positive cases
@@ -11,10 +7,11 @@ const positiveCasesFixtures = [
117
{
128
description: 'Simple transfer.',
139
input: [
14-
Clause.transferVET(
15-
Address.of('0x7567d83b7b8d80addcb281a71d54fc7b3364ffed'),
16-
VET.of(1000)
17-
),
10+
{
11+
from: '0x7567d83b7b8d80addcb281a71d54fc7b3364ffed',
12+
to: '0x7567d83b7b8d80addcb281a71d54fc7b3364ffed',
13+
value: '0x1000'
14+
},
1815
'latest'
1916
],
2017
expected: '0x5208'
@@ -30,6 +27,17 @@ const positiveCasesFixtures = [
3027
'latest'
3128
],
3229
expected: '0x45015'
30+
},
31+
{
32+
description: 'Missing from parameter',
33+
input: [
34+
{
35+
to: '0x7487d912d03ab9de786278f679592b3730bdd540',
36+
value: '0x1000'
37+
},
38+
'latest'
39+
],
40+
expected: '0x5208'
3341
}
3442
];
3543

@@ -42,16 +50,6 @@ const negativeCasesFixtures = [
4250
input: [],
4351
expected: JSONRPCInvalidParams
4452
},
45-
{
46-
description: 'Missing parameters',
47-
input: [
48-
{
49-
to: '0x7487d912d03ab9de786278f679592b3730bdd540'
50-
},
51-
'latest'
52-
],
53-
expected: JSONRPCInternalError
54-
},
5553
{
5654
description: 'Missing block reference',
5755
input: [

0 commit comments

Comments
 (0)