Skip to content

Commit

Permalink
chore: 1826
Browse files Browse the repository at this point in the history
  • Loading branch information
claytonneal committed Feb 19, 2025
1 parent f7de71b commit 12201ff
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 28 deletions.
4 changes: 2 additions & 2 deletions packages/network/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
// Coverage threshold would apply to yarn test, not yarn test:unit
const isUnitTest = process.env.UNIT;
const applyCodeCoverageLimits = process.env.APPLYCODECOVLIMITS;

module.exports = {
preset: 'ts-jest',
Expand All @@ -10,7 +10,7 @@ module.exports = {
reporters: ['default', 'jest-junit'],
workerThreads: true,
coverageThreshold:
isUnitTest !== 'true'
applyCodeCoverageLimits == 'true'
? {
global: {
branches: 98,
Expand Down
8 changes: 4 additions & 4 deletions packages/network/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
"format": "prettier --write src/**/*.ts tests/**/*.ts solo-seeding/**/*.ts",
"start-thor-solo": "echo 'Starting thor solo node ...' && docker compose -f ../../docker-compose.thor.yml up -d --wait && echo '\nThor solo node started ...'",
"stop-thor-solo": "echo 'Stopping thor solo node ...' && docker compose -f ../../docker-compose.thor.yml down && echo 'Thor solo node stopped ...'",
"test:unit": "rm -rf ./coverageUnit && UNIT=true jest --coverage --coverageDirectory=coverageUnit --group=unit",
"test:integration": "rm -rf ./coverageIntegration && jest --coverage --coverageDirectory=coverageIntegration --group=integration",
"test:integration:solo": "(yarn start-thor-solo && yarn test:integration && yarn stop-thor-solo) || yarn stop-thor-solo",
"test:unit": "rm -rf ./coverageUnit && APPLYCODECOVLIMITS=false jest --coverage --coverageDirectory=coverageUnit --group=unit",
"test:integration": "rm -rf ./coverageIntegration && APPLYCODECOVLIMITS=false jest --coverage --coverageDirectory=coverageIntegration --group=integration",
"test:integration:solo": "APPLYCODECOVLIMITS=false yarn start-thor-solo && yarn test:integration && yarn stop-thor-solo || yarn stop-thor-solo",
"test:browser": "rm -rf ./coverage && jest --coverage --coverageDirectory=coverage --group=integration --group=unit --config ./jest.config.browser.js",
"test": "rm -rf ./coverage && jest --coverage --coverageDirectory=coverage --group=integration --group=unit",
"test": "rm -rf ./coverage && APPLYCODECOVLIMITS=true jest --coverage --coverageDirectory=coverage --group=integration --group=unit",
"test:solo": "(yarn start-thor-solo && yarn test && yarn stop-thor-solo) || yarn stop-thor-solo",
"test:browser:solo": "(yarn start-thor-solo && yarn test:browser && yarn stop-thor-solo) || yarn stop-thor-solo"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const ethEstimateGas = async (
{
to: inputOptions.to ?? null,
value: inputOptions.value ?? '0x0',
data: inputOptions.data ?? '0x0'
data: inputOptions.data ?? '0x'
} satisfies SimulateTransactionClause
],
inputOptions.from,
Expand All @@ -62,7 +62,7 @@ const ethEstimateGas = async (
);

// Convert intrinsic gas to hex string and return
return await Promise.resolve('0x' + estimatedGas.totalGas.toString(16));
return '0x' + estimatedGas.totalGas.toString(16);
} catch (e) {
throw new JSONRPCInternalError(
'eth_estimateGas()',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import { Address, Clause, VET } from '@vechain/sdk-core';
import {
JSONRPCInternalError,
JSONRPCInvalidParams
} from '@vechain/sdk-errors';
import { JSONRPCInvalidParams } from '@vechain/sdk-errors';

/**
* Fixtures for positive cases
Expand All @@ -11,10 +7,11 @@ const positiveCasesFixtures = [
{
description: 'Simple transfer.',
input: [
Clause.transferVET(
Address.of('0x7567d83b7b8d80addcb281a71d54fc7b3364ffed'),
VET.of(1000)
),
{
from: '0x7567d83b7b8d80addcb281a71d54fc7b3364ffed',
to: '0x7567d83b7b8d80addcb281a71d54fc7b3364ffed',
value: '0x1000'
},
'latest'
],
expected: '0x5208'
Expand All @@ -30,6 +27,17 @@ const positiveCasesFixtures = [
'latest'
],
expected: '0x45015'
},
{
description: 'Missing from parameter',
input: [
{
to: '0x7487d912d03ab9de786278f679592b3730bdd540',
value: '0x1000'
},
'latest'
],
expected: '0x5208'
}
];

Expand All @@ -42,16 +50,6 @@ const negativeCasesFixtures = [
input: [],
expected: JSONRPCInvalidParams
},
{
description: 'Missing parameters',
input: [
{
to: '0x7487d912d03ab9de786278f679592b3730bdd540'
},
'latest'
],
expected: JSONRPCInternalError
},
{
description: 'Missing block reference',
input: [
Expand Down
3 changes: 2 additions & 1 deletion turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"$schema": "https://turbo.build/schema.json",
"tasks": {
"build": {
"dependsOn": ["^build"]
"dependsOn": ["^build"],
"cache": false
},
"check:circular-dependencies": {},
"test": {
Expand Down

0 comments on commit 12201ff

Please sign in to comment.