test

package
v0.0.0-...-7efc56f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2021 License: MIT Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMock = errors.New("some error")

	TimeMock = time.Date(2021, time.Month(7), 24, 20, 0, 0, 0, jst).Local()
	DateMock = time.Date(2021, time.Month(7), 24, 0, 0, 0, 0, jst).Local()
)

Functions

func GRPC

func GRPC(t *testing.T, expect *Response, res interface{}, err error)

func NewHTTPRequest

func NewHTTPRequest(t *testing.T, method, path string, body interface{}) *http.Request

*

  • NewHTTPRequest - HTTP Request(application/json)を生成

func NewMultipartRequest

func NewMultipartRequest(t *testing.T, method, path, field string) *http.Request

*

  • NewMultipartRequset - HTTP Request(multipart/form-data)を生成

func Now

func Now() time.Time

func TestHTTP

func TestHTTP(t *testing.T, expect *HTTPResponse, res *httptest.ResponseRecorder)

*

  • TestHTTP - HTTP Responseの検証

Types

type DBMocks

type DBMocks struct {
	UserDB        *database.Client
	BookDB        *database.Client
	InformationDB *database.Client
}

func NewDBMock

func NewDBMock(ctrl *gomock.Controller) (*DBMocks, error)

func (*DBMocks) Delete

func (m *DBMocks) Delete(cli *database.Client, tables ...string) error

func (*DBMocks) DeleteAll

func (m *DBMocks) DeleteAll() error

type FirebaseMocks

type FirebaseMocks struct {
	Auth      *authentication.Auth
	Firestore *firestore.Firestore
}

func NewFirebaseMock

func NewFirebaseMock(ctx context.Context) (*FirebaseMocks, error)

func (*FirebaseMocks) DeleteAll

func (m *FirebaseMocks) DeleteAll(ctx context.Context) error

func (*FirebaseMocks) DeleteCollection

func (m *FirebaseMocks) DeleteCollection(ctx context.Context, ref *fs.CollectionRef) error

func (*FirebaseMocks) DeleteDoc

func (m *FirebaseMocks) DeleteDoc(ctx context.Context, ref *fs.DocumentRef) error

type HTTPResponse

type HTTPResponse struct {
	Code int
	Body interface{}
}

type Response

type Response struct {
	Code    codes.Code
	Message proto.Message
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL