From 18e36bf48f6c9c1eb534ad1be4a07849a4281d61 Mon Sep 17 00:00:00 2001 From: 7h3-3mp7y-m4n Date: Fri, 1 Nov 2024 19:53:25 +0530 Subject: [PATCH] Fixed the init_test Signed-off-by: 7h3-3mp7y-m4n --- internal/command/init_test.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/internal/command/init_test.go b/internal/command/init_test.go index c5fee69..30cb782 100644 --- a/internal/command/init_test.go +++ b/internal/command/init_test.go @@ -16,8 +16,10 @@ package command import ( "context" + "fmt" "os" "path/filepath" + "slices" "strings" "testing" @@ -26,6 +28,7 @@ import ( "github.com/stretchr/testify/require" "github.com/score-spec/score-compose/internal/project" + "github.com/score-spec/score-compose/internal/provisioners" "github.com/score-spec/score-compose/internal/provisioners/loader" ) @@ -263,6 +266,10 @@ func TestInitWithProvisioners(t *testing.T) { provs, err := loader.LoadProvisionersFromDirectory(filepath.Join(td, ".score-compose"), loader.DefaultSuffix) assert.NoError(t, err) - assert.Equal(t, "template://two", provs[0].Uri()) - assert.Equal(t, "template://one", provs[1].Uri()) + expectedProvisionerUris := []string{"template://one", "template://two"} + for _, expectedUri := range expectedProvisionerUris { + assert.True(t, slices.ContainsFunc(provs, func(p provisioners.Provisioner) bool { + return p.Uri() == expectedUri + }), fmt.Sprintf("Expected provisioner '%s' not found", expectedUri)) + } }