Documentation ¶
Overview ¶
Package testutil provides fakes for testing TQ guts.
Index ¶
- func RunDBAcceptance(ctx context.Context, db db.DB, t *testing.T)
- type FakeDB
- func (f *FakeDB) AllReminders() []*reminder.Reminder
- func (f *FakeDB) Defer(_ context.Context, cb func(context.Context))
- func (f *FakeDB) DeleteReminder(_ context.Context, r *reminder.Reminder) error
- func (f *FakeDB) ExecDefers(ctx context.Context)
- func (f *FakeDB) FetchReminderRawPayloads(_ context.Context, in []*reminder.Reminder) (out []*reminder.Reminder, err error)
- func (f *FakeDB) FetchRemindersMeta(ctx context.Context, low, high string, limit int) ([]*reminder.Reminder, error)
- func (f *FakeDB) Inject(ctx context.Context) context.Context
- func (f *FakeDB) Kind() string
- func (f *FakeDB) SaveReminder(_ context.Context, r *reminder.Reminder) error
- type MockDB
- func (m *MockDB) Defer(arg0 context.Context, arg1 func(context.Context))
- func (m *MockDB) DeleteReminder(arg0 context.Context, arg1 *reminder.Reminder) error
- func (m *MockDB) EXPECT() *MockDBMockRecorder
- func (m *MockDB) FetchReminderRawPayloads(arg0 context.Context, arg1 []*reminder.Reminder) ([]*reminder.Reminder, error)
- func (m *MockDB) FetchRemindersMeta(ctx context.Context, low, high string, limit int) ([]*reminder.Reminder, error)
- func (m *MockDB) Kind() string
- func (m *MockDB) SaveReminder(arg0 context.Context, arg1 *reminder.Reminder) error
- type MockDBMockRecorder
- func (mr *MockDBMockRecorder) Defer(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockDBMockRecorder) DeleteReminder(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockDBMockRecorder) FetchReminderRawPayloads(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockDBMockRecorder) FetchRemindersMeta(ctx, low, high, limit interface{}) *gomock.Call
- func (mr *MockDBMockRecorder) Kind() *gomock.Call
- func (mr *MockDBMockRecorder) SaveReminder(arg0, arg1 interface{}) *gomock.Call
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunDBAcceptance ¶
RunDBAcceptance tests a database implementation.
Sadly, GoConvey-reported error lines are borked because it doesn't search stack in files other than "*_test.go" and "*_tests.go", which this file can't be as it is in a different package. However, you can run tests for your database via $ go test and examine stacktraces for actual true line nimber. Or, you can copy this file to your package during debugging.
Types ¶
type FakeDB ¶
type FakeDB struct {
// contains filtered or unexported fields
}
FakeDB implements Database in RAM.
func (*FakeDB) AllReminders ¶
AllReminders returns all currently saved reminders.
func (*FakeDB) DeleteReminder ¶
func (*FakeDB) ExecDefers ¶
ExecDefers executes all registered defers in reverse order.
func (*FakeDB) FetchReminderRawPayloads ¶
func (*FakeDB) FetchRemindersMeta ¶
type MockDB ¶
type MockDB struct {
// contains filtered or unexported fields
}
MockDB is a mock of DB interface.
func NewMockDB ¶
func NewMockDB(ctrl *gomock.Controller) *MockDB
NewMockDB creates a new mock instance.
func (*MockDB) DeleteReminder ¶
DeleteReminder mocks base method.
func (*MockDB) EXPECT ¶
func (m *MockDB) EXPECT() *MockDBMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockDB) FetchReminderRawPayloads ¶
func (m *MockDB) FetchReminderRawPayloads(arg0 context.Context, arg1 []*reminder.Reminder) ([]*reminder.Reminder, error)
FetchReminderRawPayloads mocks base method.
type MockDBMockRecorder ¶
type MockDBMockRecorder struct {
// contains filtered or unexported fields
}
MockDBMockRecorder is the mock recorder for MockDB.
func (*MockDBMockRecorder) Defer ¶
func (mr *MockDBMockRecorder) Defer(arg0, arg1 interface{}) *gomock.Call
Defer indicates an expected call of Defer.
func (*MockDBMockRecorder) DeleteReminder ¶
func (mr *MockDBMockRecorder) DeleteReminder(arg0, arg1 interface{}) *gomock.Call
DeleteReminder indicates an expected call of DeleteReminder.
func (*MockDBMockRecorder) FetchReminderRawPayloads ¶
func (mr *MockDBMockRecorder) FetchReminderRawPayloads(arg0, arg1 interface{}) *gomock.Call
FetchReminderRawPayloads indicates an expected call of FetchReminderRawPayloads.
func (*MockDBMockRecorder) FetchRemindersMeta ¶
func (mr *MockDBMockRecorder) FetchRemindersMeta(ctx, low, high, limit interface{}) *gomock.Call
FetchRemindersMeta indicates an expected call of FetchRemindersMeta.
func (*MockDBMockRecorder) Kind ¶
func (mr *MockDBMockRecorder) Kind() *gomock.Call
Kind indicates an expected call of Kind.
func (*MockDBMockRecorder) SaveReminder ¶
func (mr *MockDBMockRecorder) SaveReminder(arg0, arg1 interface{}) *gomock.Call
SaveReminder indicates an expected call of SaveReminder.