From 26b22c8d0ef803e37d09a35dd5cc441148d7643b Mon Sep 17 00:00:00 2001 From: skosito Date: Mon, 18 Mar 2024 23:15:00 +0100 Subject: [PATCH] Cleanup --- changelog.md | 1 + common/bitcoin/bitcoin_spv_test.go | 2 +- common/bitcoin/proof_test.go | 2 ++ common/gas_limits_test.go | 4 ++-- common/proof_test.go | 2 ++ 5 files changed, 8 insertions(+), 3 deletions(-) diff --git a/changelog.md b/changelog.md index 9a5a68c0ee..6c8af96543 100644 --- a/changelog.md +++ b/changelog.md @@ -40,6 +40,7 @@ * [1805](https://github.com/zeta-chain/node/pull/1805) - add admin and performance test and fix upgrade test * [1879](https://github.com/zeta-chain/node/pull/1879) - full coverage for messages in types packages * [1899](https://github.com/zeta-chain/node/pull/1899) - add empty test files so packages are included in coverage +* [1903](https://github.com/zeta-chain/node/pull/1903) - common package tests ### Fixes diff --git a/common/bitcoin/bitcoin_spv_test.go b/common/bitcoin/bitcoin_spv_test.go index 2ef9825e03..c675e74bf9 100644 --- a/common/bitcoin/bitcoin_spv_test.go +++ b/common/bitcoin/bitcoin_spv_test.go @@ -8,7 +8,7 @@ import ( ) func TestProve(t *testing.T) { - t.Run("returns true", func(t *testing.T) { + t.Run("returns true if empty block", func(t *testing.T) { result := Prove(chainhash.Hash{}, chainhash.Hash{}, []byte{}, 0) require.True(t, result) }) diff --git a/common/bitcoin/proof_test.go b/common/bitcoin/proof_test.go index 625e020c38..58028f427c 100644 --- a/common/bitcoin/proof_test.go +++ b/common/bitcoin/proof_test.go @@ -93,6 +93,8 @@ func TestBitcoinMerkleProof(t *testing.T) { }) } +// TODO: centralize test data +// https://github.com/zeta-chain/node/issues/1874 func LoadTestBlocks(t *testing.T) Blocks { file, err := os.Open("../testdata/test_blocks.json") require.NoError(t, err) diff --git a/common/gas_limits_test.go b/common/gas_limits_test.go index ce8b1d4663..0277e48c61 100644 --- a/common/gas_limits_test.go +++ b/common/gas_limits_test.go @@ -10,9 +10,9 @@ import ( func TestMultiplyGasPrice(t *testing.T) { testCases := []struct { name string - medianGasPrice string // Using string to facilitate easy creation of sdkmath.Uint + medianGasPrice string multiplierString string - expectedGasPrice string // Expected result also as string for easy comparison + expectedGasPrice string wantErr bool }{ { diff --git a/common/proof_test.go b/common/proof_test.go index 2976c073c6..e272e78b2d 100644 --- a/common/proof_test.go +++ b/common/proof_test.go @@ -46,6 +46,8 @@ type Blocks struct { Blocks []Block `json:"blocks"` } +// TODO: centralize test data +// https://github.com/zeta-chain/node/issues/1874 func LoadTestBlocks(t *testing.T) Blocks { file, err := os.Open("./testdata/test_blocks.json") require.NoError(t, err)