Skip to content

Commit

Permalink
fix: fixing test fail
Browse files Browse the repository at this point in the history
  • Loading branch information
nunenuh committed Aug 23, 2023
1 parent a7d970e commit e1d2213
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ jobs:
- name: Install dependencies
run: make deps

- name: Test with Go Test and Coverage
- name: Test with Go Test
run: make test

- name: Test with Go Test with Coverage
run: make test-coverage

- name: Upload coverage reports to Codecov
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/dockerhub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,16 @@ jobs:
- name: Install dependencies
run: make deps

# - name: Test with Go Test
# run: make test
- name: Test with Go Test
run: make test

- name: Test with Go Test with Coverage
run: make test-coverage

- name: build docker image
- name: Build docker image
run: make docker-build

- name: build docker image
- name: Push docker image to Dockerhub
run: make docker-push

- name: Logout from DockerHub
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ jobs:
- name: Install dependencies
run: make deps

# - name: Test with Go Test
# run: go test -v ./... -coverprofile=coverage.out
- name: Test with Go Test
run: make test

- name: Test with Go Test with Coverage
run: make test-coverage

- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
Expand Down
5 changes: 2 additions & 3 deletions internal/domain/repository/user_repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,10 @@ func TestIUserRepository_GetByID(t *testing.T) {
// Set the mock behavior for the GetByID method
expectedUser := &entity.User{ID: 1, FullName: "John Doe"}
mock.GetByIDFunc = func(ID int) (*entity.User, error) {
x := expectedUser.ID
if x != ID {
if expectedUser.ID != ID {
return nil, fmt.Errorf("user not found")
}
return nil, fmt.Errorf("user not found")
return expectedUser, nil
}

// Create an instance of the IUserRepository interface using the mock
Expand Down

0 comments on commit e1d2213

Please sign in to comment.