refactor: use shared mocks for tests
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package testhelper
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
pbaero "github.com/flowy-live/llink/genproto/aero"
|
||||
"github.com/flowy-live/llink/internal/billing"
|
||||
"github.com/flowy-live/llink/internal/network"
|
||||
"github.com/flowy-live/llink/internal/testhelper/mocks/aero"
|
||||
"github.com/jackc/pgx/v5/pgxpool"
|
||||
"go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
func NewNetworkService(t *testing.T, pool *pgxpool.Pool) network.Service {
|
||||
t.Helper()
|
||||
ctrl := gomock.NewController(t)
|
||||
mockAero := aero.NewMockPrimaryClient(ctrl)
|
||||
mockAero.EXPECT().
|
||||
ShootEmail(gomock.Any(), gomock.Any()).
|
||||
Return(&pbaero.ShootEmailResponse{}, nil).
|
||||
AnyTimes()
|
||||
return network.NewService(pool, mockAero, billing.Noop(), nil)
|
||||
}
|
||||
Reference in New Issue
Block a user