From 17de51d98a1adac964811f073f9b5baefebf93bc Mon Sep 17 00:00:00 2001 From: Carlton N Hanna Date: Fri, 12 Apr 2024 12:07:30 -0600 Subject: [PATCH] fix auto merge issue make test encoding config --- app/app_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/app/app_test.go b/app/app_test.go index bd3769afdf..43e1909863 100644 --- a/app/app_test.go +++ b/app/app_test.go @@ -3,6 +3,7 @@ package app import ( "encoding/json" "fmt" + "os" "sort" "testing" @@ -23,6 +24,7 @@ import ( abci "github.com/cometbft/cometbft/abci/types" + "github.com/provenance-io/provenance/app/params" markermodule "github.com/provenance-io/provenance/x/marker" markertypes "github.com/provenance-io/provenance/x/marker/types" ) @@ -425,3 +427,22 @@ func TestFilterBeginBlockerEvents(t *testing.T) { }) } } + +// MakeTestEncodingConfig creates an encoding config suitable for unit tests. +func MakeTestEncodingConfig(t *testing.T) params.EncodingConfig { + tempDir, err := os.MkdirTemp("", "tempprovapp") + switch { + case t != nil: + require.NoError(t, err, "failed to create temp dir %q", tempDir) + case err != nil: + panic(fmt.Errorf("failed to create temp dir %q: %w", tempDir, err)) + } + defer os.RemoveAll(tempDir) + + tempApp := New(log.NewNopLogger(), dbm.NewMemDB(), nil, true, nil, + tempDir, + 0, + simtestutil.EmptyAppOptions{}, + ) + return tempApp.GetEncodingConfig() +}