refactor: unit testable units and cleaner dep injection

This commit is contained in:
Arjun Patel
2026-04-27 16:07:28 -07:00
parent 013c453dd3
commit 48d6d5cb07
26 changed files with 761 additions and 617 deletions
+6
View File
@@ -0,0 +1,6 @@
// Package aero hosts a mock for the third-party aero gRPC client. The
// interface is generated protobuf code we don't own, so the //go:generate
// directive lives here rather than next to the source.
package aero
//go:generate mockgen -destination ./mock_aero.go -package aero github.com/flowy-live/llink/genproto/aero PrimaryClient
+2 -89
View File
@@ -1,9 +1,9 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: /Users/talksik/Documents/code/llink/go/genproto/aero/main_grpc.pb.go
// Source: github.com/flowy-live/llink/genproto/aero (interfaces: PrimaryClient)
//
// Generated by this command:
//
// mockgen -source=/Users/talksik/Documents/code/llink/go/genproto/aero/main_grpc.pb.go -destination=/Users/talksik/Documents/code/llink/go/internal/testhelper/mocks/aero/mock_aero.go -package=aero
// mockgen -destination ./mock_aero.go -package aero github.com/flowy-live/llink/genproto/aero PrimaryClient
//
// Package aero is a generated GoMock package.
@@ -61,90 +61,3 @@ func (mr *MockPrimaryClientMockRecorder) ShootEmail(ctx, in any, opts ...any) *g
varargs := append([]any{ctx, in}, opts...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ShootEmail", reflect.TypeOf((*MockPrimaryClient)(nil).ShootEmail), varargs...)
}
// MockPrimaryServer is a mock of PrimaryServer interface.
type MockPrimaryServer struct {
ctrl *gomock.Controller
recorder *MockPrimaryServerMockRecorder
isgomock struct{}
}
// MockPrimaryServerMockRecorder is the mock recorder for MockPrimaryServer.
type MockPrimaryServerMockRecorder struct {
mock *MockPrimaryServer
}
// NewMockPrimaryServer creates a new mock instance.
func NewMockPrimaryServer(ctrl *gomock.Controller) *MockPrimaryServer {
mock := &MockPrimaryServer{ctrl: ctrl}
mock.recorder = &MockPrimaryServerMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockPrimaryServer) EXPECT() *MockPrimaryServerMockRecorder {
return m.recorder
}
// ShootEmail mocks base method.
func (m *MockPrimaryServer) ShootEmail(arg0 context.Context, arg1 *pbaero.ShootEmailRequest) (*pbaero.ShootEmailResponse, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ShootEmail", arg0, arg1)
ret0, _ := ret[0].(*pbaero.ShootEmailResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// ShootEmail indicates an expected call of ShootEmail.
func (mr *MockPrimaryServerMockRecorder) ShootEmail(arg0, arg1 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ShootEmail", reflect.TypeOf((*MockPrimaryServer)(nil).ShootEmail), arg0, arg1)
}
// mustEmbedUnimplementedPrimaryServer mocks base method.
func (m *MockPrimaryServer) mustEmbedUnimplementedPrimaryServer() {
m.ctrl.T.Helper()
m.ctrl.Call(m, "mustEmbedUnimplementedPrimaryServer")
}
// mustEmbedUnimplementedPrimaryServer indicates an expected call of mustEmbedUnimplementedPrimaryServer.
func (mr *MockPrimaryServerMockRecorder) mustEmbedUnimplementedPrimaryServer() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "mustEmbedUnimplementedPrimaryServer", reflect.TypeOf((*MockPrimaryServer)(nil).mustEmbedUnimplementedPrimaryServer))
}
// MockUnsafePrimaryServer is a mock of UnsafePrimaryServer interface.
type MockUnsafePrimaryServer struct {
ctrl *gomock.Controller
recorder *MockUnsafePrimaryServerMockRecorder
isgomock struct{}
}
// MockUnsafePrimaryServerMockRecorder is the mock recorder for MockUnsafePrimaryServer.
type MockUnsafePrimaryServerMockRecorder struct {
mock *MockUnsafePrimaryServer
}
// NewMockUnsafePrimaryServer creates a new mock instance.
func NewMockUnsafePrimaryServer(ctrl *gomock.Controller) *MockUnsafePrimaryServer {
mock := &MockUnsafePrimaryServer{ctrl: ctrl}
mock.recorder = &MockUnsafePrimaryServerMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockUnsafePrimaryServer) EXPECT() *MockUnsafePrimaryServerMockRecorder {
return m.recorder
}
// mustEmbedUnimplementedPrimaryServer mocks base method.
func (m *MockUnsafePrimaryServer) mustEmbedUnimplementedPrimaryServer() {
m.ctrl.T.Helper()
m.ctrl.Call(m, "mustEmbedUnimplementedPrimaryServer")
}
// mustEmbedUnimplementedPrimaryServer indicates an expected call of mustEmbedUnimplementedPrimaryServer.
func (mr *MockUnsafePrimaryServerMockRecorder) mustEmbedUnimplementedPrimaryServer() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "mustEmbedUnimplementedPrimaryServer", reflect.TypeOf((*MockUnsafePrimaryServer)(nil).mustEmbedUnimplementedPrimaryServer))
}