From a946a573d600f6485948b7d8019a6c974386401c Mon Sep 17 00:00:00 2001 From: Jordan Krage Date: Wed, 4 Dec 2024 07:57:43 -0600 Subject: [PATCH] pkg/types/interfacetests: simplify test names (#959) --- .../chain_components_interface_tests.go | 8 +++++--- pkg/types/interfacetests/utils.go | 16 +++++++++------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/pkg/types/interfacetests/chain_components_interface_tests.go b/pkg/types/interfacetests/chain_components_interface_tests.go index 65edbe376..1c1e9a001 100644 --- a/pkg/types/interfacetests/chain_components_interface_tests.go +++ b/pkg/types/interfacetests/chain_components_interface_tests.go @@ -100,9 +100,11 @@ var AnySliceToReadWithoutAnArgument = []uint64{3, 4} const AnyExtraValue = 3 func RunContractReaderInterfaceTests[T TestingT[T]](t T, tester ChainComponentsInterfaceTester[T], mockRun bool) { - t.Run("GetLatestValue for "+tester.Name(), func(t T) { runContractReaderGetLatestValueInterfaceTests(t, tester, mockRun) }) - t.Run("BatchGetLatestValues for "+tester.Name(), func(t T) { runContractReaderBatchGetLatestValuesInterfaceTests(t, tester, mockRun) }) - t.Run("QueryKey for "+tester.Name(), func(t T) { runQueryKeyInterfaceTests(t, tester) }) + t.Run(tester.Name(), func(t T) { + t.Run("GetLatestValue", func(t T) { runContractReaderGetLatestValueInterfaceTests(t, tester, mockRun) }) + t.Run("BatchGetLatestValues", func(t T) { runContractReaderBatchGetLatestValuesInterfaceTests(t, tester, mockRun) }) + t.Run("QueryKey", func(t T) { runQueryKeyInterfaceTests(t, tester) }) + }) } func runContractReaderGetLatestValueInterfaceTests[T TestingT[T]](t T, tester ChainComponentsInterfaceTester[T], mockRun bool) { diff --git a/pkg/types/interfacetests/utils.go b/pkg/types/interfacetests/utils.go index 01182cc34..203ff1980 100644 --- a/pkg/types/interfacetests/utils.go +++ b/pkg/types/interfacetests/utils.go @@ -56,14 +56,16 @@ type TestingT[T any] interface { // Tests execution utility function that will consider enabled / disabled test cases according to // Basic Tester configuration. func RunTests[T TestingT[T]](t T, tester BasicTester[T], tests []Testcase[T]) { - for _, test := range tests { - if !tester.IsDisabled(test.Name) { - t.Run(test.Name+" for "+tester.Name(), func(t T) { - tester.Setup(t) - test.Test(t) - }) + t.Run(tester.Name(), func(t T) { + for _, test := range tests { + if !tester.IsDisabled(test.Name) { + t.Run(test.Name, func(t T) { + tester.Setup(t) + test.Test(t) + }) + } } - } + }) } // Batch contract write takes a batch call entry and writes it to the chain using the ContractWriter.