Skip to content

Commit

Permalink
chore: change github client creation to value
Browse files Browse the repository at this point in the history
  • Loading branch information
sacha-c committed Jan 9, 2025
1 parent 78f8edf commit 2547e1a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
4 changes: 2 additions & 2 deletions internal/repository/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ type githubService struct {
}

// newGithubRepo creates a new GitHub repository service
func New(token string) (*githubService, error) {
func New(token string) githubService {
client := github.NewClient(nil)

s := githubService{client: &githubClient{client: client}, token: token}

return &s, nil
return s
}

func (s githubService) GetProjectList(paths []string) (projects []repository.Project, warn error) {
Expand Down
7 changes: 0 additions & 7 deletions internal/repository/github/github_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@ import (
"github.com/stretchr/testify/mock"
)

func TestNewService(t *testing.T) {
s, err := New("token")

assert.Nil(t, err)
assert.NotNil(t, s)
}

func TestGetProjectListOrganizationRepos(t *testing.T) {
mockService := mockService{}
mockService.On("GetOrganizationRepositories", "org", mock.Anything).Return([]*github.Repository{{Name: github.Ptr("Hello World")}}, &github.Response{}, nil)
Expand Down
5 changes: 1 addition & 4 deletions internal/repository/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ func NewProvider(gitlabToken string, githubToken string) (IProvider, error) {
return nil, errors.Join(fmt.Errorf("failed to create gitlab provider"), err)
}

githubService, err := github.New(githubToken)
if err != nil {
return nil, errors.Join(fmt.Errorf("failed to create github provider"), err)
}
githubService := github.New(githubToken)

return provider{
gitlabService: gitlabService,
Expand Down

0 comments on commit 2547e1a

Please sign in to comment.