Skip to content

Commit 9ccc541

Browse files
committed
Minor test fix
1 parent 3a0820e commit 9ccc541

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

05-02-timeouts/internal/platform/storage/mysql/course_repository_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"errors"
66
"testing"
7+
"time"
78

89
mooc "github.com/CodelyTV/go-hexagonal_http_api-course/05-02-timeouts/internal"
910
"github.com/DATA-DOG/go-sqlmock"
@@ -24,7 +25,7 @@ func Test_CourseRepository_Save_RepositoryError(t *testing.T) {
2425
WithArgs(courseID, courseName, courseDuration).
2526
WillReturnError(errors.New("something-failed"))
2627

27-
repo := NewCourseRepository(db)
28+
repo := NewCourseRepository(db, 1*time.Millisecond)
2829

2930
err = repo.Save(context.Background(), course)
3031

@@ -45,7 +46,7 @@ func Test_CourseRepository_Save_Succeed(t *testing.T) {
4546
WithArgs(courseID, courseName, courseDuration).
4647
WillReturnResult(sqlmock.NewResult(0, 1))
4748

48-
repo := NewCourseRepository(db)
49+
repo := NewCourseRepository(db, 1*time.Millisecond)
4950

5051
err = repo.Save(context.Background(), course)
5152

06-02-time-parse-in-go/internal/platform/storage/mysql/course_repository_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"errors"
66
"testing"
7+
"time"
78

89
mooc "github.com/CodelyTV/go-hexagonal_http_api-course/06-02-time-parse-in-go/internal"
910
"github.com/DATA-DOG/go-sqlmock"
@@ -24,7 +25,7 @@ func Test_CourseRepository_Save_RepositoryError(t *testing.T) {
2425
WithArgs(courseID, courseName, courseDuration).
2526
WillReturnError(errors.New("something-failed"))
2627

27-
repo := NewCourseRepository(db)
28+
repo := NewCourseRepository(db, 1*time.Millisecond)
2829

2930
err = repo.Save(context.Background(), course)
3031

@@ -45,7 +46,7 @@ func Test_CourseRepository_Save_Succeed(t *testing.T) {
4546
WithArgs(courseID, courseName, courseDuration).
4647
WillReturnResult(sqlmock.NewResult(0, 1))
4748

48-
repo := NewCourseRepository(db)
49+
repo := NewCourseRepository(db, 1*time.Millisecond)
4950

5051
err = repo.Save(context.Background(), course)
5152

06-03-gin-middlewares/internal/platform/storage/mysql/course_repository_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"errors"
66
"testing"
7+
"time"
78

89
mooc "github.com/CodelyTV/go-hexagonal_http_api-course/06-03-gin-middlewares/internal"
910
"github.com/DATA-DOG/go-sqlmock"
@@ -24,7 +25,7 @@ func Test_CourseRepository_Save_RepositoryError(t *testing.T) {
2425
WithArgs(courseID, courseName, courseDuration).
2526
WillReturnError(errors.New("something-failed"))
2627

27-
repo := NewCourseRepository(db)
28+
repo := NewCourseRepository(db, 1*time.Millisecond)
2829

2930
err = repo.Save(context.Background(), course)
3031

@@ -45,7 +46,7 @@ func Test_CourseRepository_Save_Succeed(t *testing.T) {
4546
WithArgs(courseID, courseName, courseDuration).
4647
WillReturnResult(sqlmock.NewResult(0, 1))
4748

48-
repo := NewCourseRepository(db)
49+
repo := NewCourseRepository(db, 1*time.Millisecond)
4950

5051
err = repo.Save(context.Background(), course)
5152

0 commit comments

Comments
 (0)