/
mock.go
38 lines (31 loc) · 1.02 KB
/
mock.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package index
import (
"context"
"github.com/stretchr/testify/mock"
)
// Mock mocks the Index interface.
type Mock struct {
mock.Mock
}
// Index mocks the Index method on the Index interface.
func (m *Mock) Index(ctx context.Context, id string, properties interface{}) error {
args := m.Called(ctx, id, properties)
return args.Error(0)
}
// Update mocks the Update method on the Index interface.
func (m *Mock) Update(ctx context.Context, id string, properties interface{}) error {
args := m.Called(ctx, id, properties)
return args.Error(0)
}
// Get mocks the Get method on the Index interface.
func (m *Mock) Get(ctx context.Context, id string, dst interface{}, fields ...string) (bool, error) {
args := m.Called(ctx, id, dst, fields)
return args.Bool(0), args.Error(1)
}
// Delete mocks the Delete method on the Index interface.
func (m *Mock) Delete(ctx context.Context, id string) error {
args := m.Called(ctx, id)
return args.Error(0)
}
// Compile-time assurance that implementation satisfies interface.
var _ Index = &Mock{}