Move mocks to their own packages
This commit is contained in:
parent
15f90c1e19
commit
b5bd054bbe
5 changed files with 12 additions and 10 deletions
|
@ -1,8 +1,8 @@
|
||||||
// Code generated by MockGen. DO NOT EDIT.
|
// Code generated by MockGen. DO NOT EDIT.
|
||||||
// Source: service.go
|
// Source: service.go
|
||||||
|
|
||||||
// Package notification is a generated GoMock package.
|
// Package mocks is a generated GoMock package.
|
||||||
package notification
|
package mocks
|
||||||
|
|
||||||
import (
|
import (
|
||||||
reflect "reflect"
|
reflect "reflect"
|
|
@ -1,4 +1,4 @@
|
||||||
//go:generate mockgen -source=service.go -destination=service_mock.go -package=notification
|
//go:generate mockgen -source=service.go -destination=mocks/service_mock.go -package=mocks
|
||||||
package notification
|
package notification
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -7,6 +7,8 @@ import (
|
||||||
|
|
||||||
"git.ctrlz.es/mgdelacroix/birthdaybot/model"
|
"git.ctrlz.es/mgdelacroix/birthdaybot/model"
|
||||||
"git.ctrlz.es/mgdelacroix/birthdaybot/notification"
|
"git.ctrlz.es/mgdelacroix/birthdaybot/notification"
|
||||||
|
notification_mocks "git.ctrlz.es/mgdelacroix/birthdaybot/notification/mocks"
|
||||||
|
server_mocks "git.ctrlz.es/mgdelacroix/birthdaybot/server/mocks"
|
||||||
"github.com/charmbracelet/log"
|
"github.com/charmbracelet/log"
|
||||||
"github.com/golang/mock/gomock"
|
"github.com/golang/mock/gomock"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
@ -15,8 +17,8 @@ import (
|
||||||
type TestHelper struct {
|
type TestHelper struct {
|
||||||
t *testing.T
|
t *testing.T
|
||||||
ctrl *gomock.Controller
|
ctrl *gomock.Controller
|
||||||
mockNotificationService *notification.MockNotificationService
|
mockNotificationService *notification_mocks.MockNotificationService
|
||||||
mockWorker *MockWorker
|
mockWorker *server_mocks.MockWorker
|
||||||
srv *Server
|
srv *Server
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,10 +35,10 @@ func SetupTestHelper(t *testing.T) *TestHelper {
|
||||||
th := &TestHelper{t: t}
|
th := &TestHelper{t: t}
|
||||||
th.ctrl = gomock.NewController(t)
|
th.ctrl = gomock.NewController(t)
|
||||||
|
|
||||||
th.mockNotificationService = notification.NewMockNotificationService(th.ctrl)
|
th.mockNotificationService = notification_mocks.NewMockNotificationService(th.ctrl)
|
||||||
notificationServices := []notification.NotificationService{th.mockNotificationService}
|
notificationServices := []notification.NotificationService{th.mockNotificationService}
|
||||||
|
|
||||||
th.mockWorker = NewMockWorker(th.ctrl)
|
th.mockWorker = server_mocks.NewMockWorker(th.ctrl)
|
||||||
workers := []Worker{th.mockWorker}
|
workers := []Worker{th.mockWorker}
|
||||||
th.mockWorker.EXPECT().Start().Times(1)
|
th.mockWorker.EXPECT().Start().Times(1)
|
||||||
th.mockWorker.EXPECT().Stop().Times(1)
|
th.mockWorker.EXPECT().Stop().Times(1)
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// Code generated by MockGen. DO NOT EDIT.
|
// Code generated by MockGen. DO NOT EDIT.
|
||||||
// Source: worker.go
|
// Source: worker.go
|
||||||
|
|
||||||
// Package server is a generated GoMock package.
|
// Package mocks is a generated GoMock package.
|
||||||
package server
|
package mocks
|
||||||
|
|
||||||
import (
|
import (
|
||||||
reflect "reflect"
|
reflect "reflect"
|
|
@ -1,4 +1,4 @@
|
||||||
//go:generate mockgen -source=worker.go -destination=worker_mock.go -package=server
|
//go:generate mockgen -source=worker.go -destination=mocks/worker_mock.go -package=mocks
|
||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
Loading…
Reference in a new issue