From b248714b32aeec3ea9111c627ca901106374d3e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lker=20G=2E=20=C3=96zt=C3=BCrk?= Date: Fri, 18 Mar 2022 15:58:32 +0300 Subject: [PATCH] fix(cosmosanalysis): fix tests --- starport/pkg/cosmosanalysis/cosmosanalysis_test.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/starport/pkg/cosmosanalysis/cosmosanalysis_test.go b/starport/pkg/cosmosanalysis/cosmosanalysis_test.go index c903504370..30f40b5089 100644 --- a/starport/pkg/cosmosanalysis/cosmosanalysis_test.go +++ b/starport/pkg/cosmosanalysis/cosmosanalysis_test.go @@ -1,7 +1,6 @@ package cosmosanalysis_test import ( - "errors" "os" "path/filepath" "testing" @@ -87,6 +86,7 @@ func TestFindImplementation(t *testing.T) { f1 := filepath.Join(tmpDir, "1.go") err = os.WriteFile(f1, file1, 0644) require.NoError(t, err) + f2 := filepath.Join(tmpDir, "2.go") err = os.WriteFile(f2, file2, 0644) require.NoError(t, err) @@ -159,7 +159,7 @@ func TestFindAppFilePath(t *testing.T) { // No file _, err = cosmosanalysis.FindAppFilePath(tmpDir) - require.Equal(t, errors.New("app file not found"), err) + require.Equal(t, "app.go file cannot be found", err.Error()) // Only one file with app implementation myOwnAppFilePath := filepath.Join(secondaryAppFolder, "my_own_app.go") @@ -174,7 +174,7 @@ func TestFindAppFilePath(t *testing.T) { err = os.WriteFile(appTestFilePath, appTestFile, 0644) require.NoError(t, err) pathFound, err = cosmosanalysis.FindAppFilePath(tmpDir) - require.Equal(t, errors.New("multiple app files found, but no app.go file"), err) + require.Contains(t, err.Error(), "cannot locate your app.go") // With an additional app file (that is app.go) appFilePath := filepath.Join(appFolder, "app.go") @@ -189,5 +189,6 @@ func TestFindAppFilePath(t *testing.T) { err = os.WriteFile(extraAppFilePath, appFile, 0644) require.NoError(t, err) pathFound, err = cosmosanalysis.FindAppFilePath(tmpDir) - require.Equal(t, errors.New("multiple app.go files found"), err) + require.NoError(t, err) + require.Equal(t, filepath.Join(appFolder, "app.go"), pathFound) }