[feature] migrate to monorepo
This commit is contained in:
commit
05ddc1f783
267 changed files with 75165 additions and 0 deletions
32
backend/internal/testutil/mock.go
Normal file
32
backend/internal/testutil/mock.go
Normal file
|
@ -0,0 +1,32 @@
|
|||
package testutil
|
||||
|
||||
import (
|
||||
"io"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// MockReadCloser is a mock implementation of io.ReadCloser
|
||||
type MockReadCloser struct {
|
||||
io.Reader
|
||||
CloseFunc func() error
|
||||
}
|
||||
|
||||
func (m MockReadCloser) Close() error {
|
||||
if m.CloseFunc != nil {
|
||||
return m.CloseFunc()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewMockReadCloser creates a new MockReadCloser with the given content
|
||||
func NewMockReadCloser(content string) io.ReadCloser {
|
||||
return MockReadCloser{Reader: strings.NewReader(content)}
|
||||
}
|
||||
|
||||
// RequireMockEquals asserts that two mocks are equal
|
||||
func RequireMockEquals(t *testing.T, expected, actual interface{}) {
|
||||
require.Equal(t, expected, actual)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue