-
Notifications
You must be signed in to change notification settings - Fork 545
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add a hanlder unit test for upstream and remove init
- Loading branch information
1 parent
f2ff23a
commit 8a1da59
Showing
5 changed files
with
90 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package store | ||
|
||
import ( | ||
"context" | ||
"github.com/stretchr/testify/mock" | ||
) | ||
|
||
type MockInterface struct { | ||
mock.Mock | ||
} | ||
|
||
func (m *MockInterface) Get(key string) (interface{}, error) { | ||
ret := m.Mock.Called(key) | ||
return ret.Get(0), ret.Error(1) | ||
} | ||
|
||
func (m *MockInterface) List(input ListInput) (*ListOutput, error) { | ||
ret := m.Mock.Called(input) | ||
return ret.Get(0).(*ListOutput), ret.Error(1) | ||
} | ||
|
||
func (m *MockInterface) Create(ctx context.Context, obj interface{}) error { | ||
ret := m.Mock.Called(ctx, obj) | ||
return ret.Error(0) | ||
} | ||
|
||
func (m *MockInterface) Update(ctx context.Context, obj interface{}, createOnFail bool) error { | ||
ret := m.Mock.Called(ctx, obj, createOnFail) | ||
return ret.Error(0) | ||
} | ||
|
||
func (m *MockInterface) BatchDelete(ctx context.Context, keys []string) error { | ||
ret := m.Mock.Called(ctx, keys) | ||
return ret.Error(0) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters