refactor: use shared mocks for tests

This commit is contained in:
talksik
2026-04-22 09:06:10 -07:00
parent 2e9ff742a0
commit 110f4594be
10 changed files with 304 additions and 174 deletions
+23
View File
@@ -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)
}