From d6fd3b0ef7a824fdb659e1729c7245fd90b5f2f5 Mon Sep 17 00:00:00 2001 From: Oleksii Kosynskyi Date: Wed, 2 Oct 2024 19:26:44 -0400 Subject: [PATCH] test with new keys --- .github/workflows/e2e_network_tests.yml | 8 ++-- .../e2e/get_block_transaction_count.test.ts | 44 +++++++++++-------- .../test/e2e/get_block_uncle_count.test.ts | 6 +-- .../web3/test/e2e/get_fee_history.test.ts | 2 +- packages/web3/test/e2e/get_proof.test.ts | 8 ++-- .../test/e2e/get_protocol_version.test.ts | 3 +- 6 files changed, 38 insertions(+), 33 deletions(-) diff --git a/.github/workflows/e2e_network_tests.yml b/.github/workflows/e2e_network_tests.yml index 232420fca12..800b3a116df 100644 --- a/.github/workflows/e2e_network_tests.yml +++ b/.github/workflows/e2e_network_tests.yml @@ -7,10 +7,10 @@ on: - v4.* # For test purpose only: -# pull_request: -# branches: -# - '4.x' -# types: [ opened, reopened, synchronize ] + pull_request: + branches: + - '4.x' + types: [ opened, reopened, synchronize ] jobs: build: name: Build Packages diff --git a/packages/web3/test/e2e/get_block_transaction_count.test.ts b/packages/web3/test/e2e/get_block_transaction_count.test.ts index 8e737aa8cda..05200312dc8 100644 --- a/packages/web3/test/e2e/get_block_transaction_count.test.ts +++ b/packages/web3/test/e2e/get_block_transaction_count.test.ts @@ -77,29 +77,35 @@ describe(`${getSystemTestBackend()} tests - getBlockTransactionCount`, () => { _blockData = block === 'blockHash' ? (latestBlock.hash as string) : Number(latestBlock.number); } + const result = await web3.eth.getBlockTransactionCount(_blockData, { number: format as FMT_NUMBER, bytes: FMT_BYTES.HEX, }); - switch (format) { - case 'NUMBER_NUMBER': - // eslint-disable-next-line jest/no-conditional-expect - expect(isNumber(result)).toBeTruthy(); - break; - case 'NUMBER_HEX': - // eslint-disable-next-line jest/no-conditional-expect - expect(isHexStrict(result)).toBeTruthy(); - break; - case 'NUMBER_STR': - // eslint-disable-next-line jest/no-conditional-expect - expect(isString(result)).toBeTruthy(); - break; - case 'NUMBER_BIGINT': - // eslint-disable-next-line jest/no-conditional-expect - expect(isBigInt(result)).toBeTruthy(); - break; - default: - throw new Error('Unhandled format'); + if (block === 'pending') { + // eslint-disable-next-line jest/no-conditional-expect + expect(result).toBeNull(); + } else { + switch (format) { + case 'NUMBER_NUMBER': + // eslint-disable-next-line jest/no-conditional-expect + expect(isNumber(result)).toBeTruthy(); + break; + case 'NUMBER_HEX': + // eslint-disable-next-line jest/no-conditional-expect + expect(isHexStrict(result)).toBeTruthy(); + break; + case 'NUMBER_STR': + // eslint-disable-next-line jest/no-conditional-expect + expect(isString(result)).toBeTruthy(); + break; + case 'NUMBER_BIGINT': + // eslint-disable-next-line jest/no-conditional-expect + expect(isBigInt(result)).toBeTruthy(); + break; + default: + throw new Error('Unhandled format'); + } } }); }); diff --git a/packages/web3/test/e2e/get_block_uncle_count.test.ts b/packages/web3/test/e2e/get_block_uncle_count.test.ts index c06f57aec85..fd209faaacf 100644 --- a/packages/web3/test/e2e/get_block_uncle_count.test.ts +++ b/packages/web3/test/e2e/get_block_uncle_count.test.ts @@ -14,7 +14,7 @@ GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with web3.js. If not, see . */ -import Web3 from '../../src'; +import { Web3 } from '../../src'; import { getSystemE2ETestProvider } from './e2e_utils'; import { closeOpenConnection, @@ -74,8 +74,8 @@ describeIf(getSystemTestBackend() !== 'hardhat')( : Number(latestBlock.number); } const result = await web3.eth.getBlockUncleCount(_blockData); - - expect(result).toBe(BigInt(0)); + // eslint-disable-next-line no-null/no-null + expect(result).toBe(block === 'pending' || block === 'earliest' ? null : BigInt(0)); }); }, ); diff --git a/packages/web3/test/e2e/get_fee_history.test.ts b/packages/web3/test/e2e/get_fee_history.test.ts index 9097b310e90..0a10d49bebd 100644 --- a/packages/web3/test/e2e/get_fee_history.test.ts +++ b/packages/web3/test/e2e/get_fee_history.test.ts @@ -62,7 +62,7 @@ describe(`${getSystemTestBackend()} tests - estimateGas`, () => { format: string; }>({ blockCount: [1, '2', 3, BigInt(4)], - newestBlock: ['earliest', 'latest', 'pending', 'safe', 'finalized', 'blockNumber'], + newestBlock: ['earliest', 'latest', 'safe', 'finalized', 'blockNumber'], rewardPercentiles: [['0xa', '20', 30, BigInt(40)]], format: Object.values(FMT_NUMBER), }), diff --git a/packages/web3/test/e2e/get_proof.test.ts b/packages/web3/test/e2e/get_proof.test.ts index 33ddeba2bc7..059f210d2bc 100644 --- a/packages/web3/test/e2e/get_proof.test.ts +++ b/packages/web3/test/e2e/get_proof.test.ts @@ -55,13 +55,13 @@ describe(`${getSystemTestBackend()} tests - getProof`, () => { | 'blockNumber'; }>({ block: [ - 'earliest', + // 'earliest', // error "distance to target block exceeds maximum proof window" 'latest', - // 'pending', + // 'pending', // error "unknown block number" 'safe', 'finalized', - // 'blockHash', - // 'blockNumber', + // 'blockHash', // error "distance to target block exceeds maximum proof window" + // 'blockNumber', // error "distance to target block exceeds maximum proof window" ], }), )('getProof', async ({ block }) => { diff --git a/packages/web3/test/e2e/get_protocol_version.test.ts b/packages/web3/test/e2e/get_protocol_version.test.ts index 6120d6ca7f7..49da2e4550b 100644 --- a/packages/web3/test/e2e/get_protocol_version.test.ts +++ b/packages/web3/test/e2e/get_protocol_version.test.ts @@ -33,8 +33,7 @@ describe(`${getSystemTestBackend()} tests - getProtocolVersion`, () => { await closeOpenConnection(web3); }); - // doesn't exists with lodestar provider - it.skip('should get the protocol version for the connected node', async () => { + it('should get the protocol version for the connected node', async () => { const result = await web3.eth.getProtocolVersion(); expect(isHexStrict(result)).toBeTruthy(); });