Documentation ¶
Overview ¶
Package testutil provides utilities for testing.
Index ¶
- Constants
- func NewUserRegistrationRequestMatcher(t *testing.T, want *user.RegistrationRequest, wantPassword string) func(*user.RegistrationRequest) bool
- func NewUserUpdateRequestMatcher(t *testing.T, want *user.UpdateRequest, wantPassword option.Option[string]) func(*user.UpdateRequest) bool
- type FixedTimeSource
- type MockUserService
- func (m *MockUserService) Authenticate(ctx context.Context, req *user.AuthRequest) (*user.User, error)
- func (m *MockUserService) GetUser(ctx context.Context, id uuid.UUID) (*user.User, error)
- func (m *MockUserService) Register(ctx context.Context, req *user.RegistrationRequest) (*user.User, error)
- func (m *MockUserService) UpdateUser(ctx context.Context, req *user.UpdateRequest) (*user.User, error)
- type StdTimeSource
- type TimeSource
Constants ¶
View Source
const FiberTestTimeoutMillis = 10000
FiberTestTimeoutMillis specifies the timeout for a test request to a Fiber HTTP server.
When tests are run with the race detector, the default 1-second timeout for a Fiber request may be exceeded.
Variables ¶
This section is empty.
Functions ¶
func NewUserRegistrationRequestMatcher ¶
func NewUserRegistrationRequestMatcher( t *testing.T, want *user.RegistrationRequest, wantPassword string, ) func(*user.RegistrationRequest) bool
func NewUserUpdateRequestMatcher ¶
func NewUserUpdateRequestMatcher( t *testing.T, want *user.UpdateRequest, wantPassword option.Option[string], ) func(*user.UpdateRequest) bool
Types ¶
type FixedTimeSource ¶
FixedTimeSource returns a fixed time.
func (FixedTimeSource) Now ¶
func (f FixedTimeSource) Now() time.Time
type MockUserService ¶
func (*MockUserService) Authenticate ¶
func (m *MockUserService) Authenticate(ctx context.Context, req *user.AuthRequest) (*user.User, error)
func (*MockUserService) Register ¶
func (m *MockUserService) Register(ctx context.Context, req *user.RegistrationRequest) (*user.User, error)
func (*MockUserService) UpdateUser ¶
func (m *MockUserService) UpdateUser(ctx context.Context, req *user.UpdateRequest) (*user.User, error)
type StdTimeSource ¶
type StdTimeSource struct{}
StdTimeSource keeps time using the standard library.
func (StdTimeSource) Now ¶
func (StdTimeSource) Now() time.Time
type TimeSource ¶
TimeSource provides the current time, allowing time to be mocked in tests.
Click to show internal directories.
Click to hide internal directories.