Documentation
¶
Overview ¶
Package analyticsmock provides moq-generated mocks for the analytics package.
Index ¶
- type EventReporterMock
- func (mock *EventReporterMock) AddUser(ctx context.Context, userID string, properties map[string]any) error
- func (mock *EventReporterMock) AddUserCalls() []struct{ ... }
- func (mock *EventReporterMock) Close()
- func (mock *EventReporterMock) CloseCalls() []struct{}
- func (mock *EventReporterMock) EventOccurred(ctx context.Context, event string, userID string, properties map[string]any) error
- func (mock *EventReporterMock) EventOccurredAnonymous(ctx context.Context, event string, anonymousID string, ...) error
- func (mock *EventReporterMock) EventOccurredAnonymousCalls() []struct{ ... }
- func (mock *EventReporterMock) EventOccurredCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventReporterMock ¶
type EventReporterMock struct {
// AddUserFunc mocks the AddUser method.
AddUserFunc func(ctx context.Context, userID string, properties map[string]any) error
// CloseFunc mocks the Close method.
CloseFunc func()
// EventOccurredFunc mocks the EventOccurred method.
EventOccurredFunc func(ctx context.Context, event string, userID string, properties map[string]any) error
// EventOccurredAnonymousFunc mocks the EventOccurredAnonymous method.
EventOccurredAnonymousFunc func(ctx context.Context, event string, anonymousID string, properties map[string]any) error
// contains filtered or unexported fields
}
EventReporterMock is a mock implementation of analytics.EventReporter.
func TestSomethingThatUsesEventReporter(t *testing.T) {
// make and configure a mocked analytics.EventReporter
mockedEventReporter := &EventReporterMock{
AddUserFunc: func(ctx context.Context, userID string, properties map[string]any) error {
panic("mock out the AddUser method")
},
CloseFunc: func() {
panic("mock out the Close method")
},
EventOccurredFunc: func(ctx context.Context, event string, userID string, properties map[string]any) error {
panic("mock out the EventOccurred method")
},
EventOccurredAnonymousFunc: func(ctx context.Context, event string, anonymousID string, properties map[string]any) error {
panic("mock out the EventOccurredAnonymous method")
},
}
// use mockedEventReporter in code that requires analytics.EventReporter
// and then make assertions.
}
func (*EventReporterMock) AddUser ¶
func (mock *EventReporterMock) AddUser(ctx context.Context, userID string, properties map[string]any) error
AddUser calls AddUserFunc.
func (*EventReporterMock) AddUserCalls ¶
func (mock *EventReporterMock) AddUserCalls() []struct { Ctx context.Context UserID string Properties map[string]any }
AddUserCalls gets all the calls that were made to AddUser. Check the length with:
len(mockedEventReporter.AddUserCalls())
func (*EventReporterMock) CloseCalls ¶
func (mock *EventReporterMock) CloseCalls() []struct { }
CloseCalls gets all the calls that were made to Close. Check the length with:
len(mockedEventReporter.CloseCalls())
func (*EventReporterMock) EventOccurred ¶
func (mock *EventReporterMock) EventOccurred(ctx context.Context, event string, userID string, properties map[string]any) error
EventOccurred calls EventOccurredFunc.
func (*EventReporterMock) EventOccurredAnonymous ¶
func (mock *EventReporterMock) EventOccurredAnonymous(ctx context.Context, event string, anonymousID string, properties map[string]any) error
EventOccurredAnonymous calls EventOccurredAnonymousFunc.
func (*EventReporterMock) EventOccurredAnonymousCalls ¶
func (mock *EventReporterMock) EventOccurredAnonymousCalls() []struct { Ctx context.Context Event string AnonymousID string Properties map[string]any }
EventOccurredAnonymousCalls gets all the calls that were made to EventOccurredAnonymous. Check the length with:
len(mockedEventReporter.EventOccurredAnonymousCalls())
func (*EventReporterMock) EventOccurredCalls ¶
func (mock *EventReporterMock) EventOccurredCalls() []struct { Ctx context.Context Event string UserID string Properties map[string]any }
EventOccurredCalls gets all the calls that were made to EventOccurred. Check the length with:
len(mockedEventReporter.EventOccurredCalls())