From a8448c9c65057210d578051d6294b358560473c5 Mon Sep 17 00:00:00 2001 From: Rizky Eko Putra Date: Tue, 18 Oct 2022 17:04:11 +0700 Subject: [PATCH] chore: update get latest tag unit test Co-authored-by: Rizky Eko Putra --- pkg/gitlab/tag_test.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 pkg/gitlab/tag_test.go diff --git a/pkg/gitlab/tag_test.go b/pkg/gitlab/tag_test.go new file mode 100644 index 0000000..c2f8a04 --- /dev/null +++ b/pkg/gitlab/tag_test.go @@ -0,0 +1,22 @@ +package gitlab_test + +import ( + "testing" + + "github.com/gopaytech/go-commons/pkg/gitlab" + "github.com/stretchr/testify/assert" +) + +func Test_tag_GetLatestTag(t *testing.T) { + t.Run("Get file from branch testing should success", func(t *testing.T) { + client, err := gitlab.NewClient("https://gitlab.com", "") + assert.NoError(t, err) + + projectClient := gitlab.NewTag(client) + + tag, err := projectClient.GetLatestTag(gitlab.NameOrId{ID: 17954603}, "^v") + assert.NoError(t, err) + assert.NotNil(t, tag) + assert.Equal(t, "v1.0.0", tag.Name) + }) +}