Skip to content

Commit

Permalink
chore(gitlabClient): remove useless tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shini4i committed Nov 20, 2024
1 parent 450e52a commit e76eafb
Showing 1 changed file with 0 additions and 57 deletions.
57 changes: 0 additions & 57 deletions cmd/emoji-gate/gitlabClient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,60 +68,3 @@ func TestGitlabClient_Init(t *testing.T) {
assert.Equal(t, 1, client.mrId)
assert.Equal(t, "test-owner/test-repo", client.projectPath)
}

func TestGitlabClient_GetProjectIDFromPath(t *testing.T) {
mockClient := &MockGitlabClient{
ProjectID: 123,
}

projectID, err := mockClient.GetProjectIDFromPath("test-path")
assert.NoError(t, err)
assert.Equal(t, 123, projectID)
}

func TestGitlabClient_FindDefaultBranch(t *testing.T) {
mockClient := &MockGitlabClient{
DefaultBranch: "main",
}

branch, err := mockClient.FindDefaultBranch(123)
assert.NoError(t, err)
assert.Equal(t, "main", branch)
}

func TestGitlabClient_GetFileContentFromBranch(t *testing.T) {
mockClient := &MockGitlabClient{
FileContent: "mock-content",
}

content, err := mockClient.GetFileContentFromBranch(123, "main", "test-path")
assert.NoError(t, err)
assert.Equal(t, "mock-content", content)
}

func TestGitlabClient_ListAwardEmoji(t *testing.T) {
// Mocking the exact inline struct for AwardEmoji.User
mockClient := &MockGitlabClient{
AwardEmojiList: []*gitlab.AwardEmoji{
{
Name: "thumbsup",
User: struct {
Name string `json:"name"`
Username string `json:"username"`
ID int `json:"id"`
State string `json:"state"`
AvatarURL string `json:"avatar_url"`
WebURL string `json:"web_url"`
}{
Username: "test-user",
},
},
},
}

emojis, err := mockClient.ListAwardEmoji()
assert.NoError(t, err)
assert.Len(t, emojis, 1)
assert.Equal(t, "thumbsup", emojis[0].Name)
assert.Equal(t, "test-user", emojis[0].User.Username)
}

0 comments on commit e76eafb

Please sign in to comment.