Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Checker ¶
type Checker func(resp interactor.Response, err error)
Checker asserts the given results.
type GivenFn ¶
type GivenFn func() interactor.UseCaseRunner
GivenFn is a test init function.
func Given ¶
func Given(useCaseRunner interactor.UseCaseRunnerFn) GivenFn
Given prepares the given use case runner for testing.
type InteractorTester ¶
InteractorTester defines a Test Suite.
func Test ¶
func Test(tb testing.TB) InteractorTester
Test runs the test.
Example:
want := &TestResponse{result: 123} useCaseRunner := &ConcreteUseCase{res: want.result} adaptedUseCaseRunner := interactor.MustAdapt(useCaseRunner.Run) Test(t)( Given(adaptedUseCaseRunner.Run), When(context.Background(), TestRequest{123}, &TestResponse{}), Then(want))
type ThenFn ¶
ThenFn prepares the Checker.
func Then ¶
func Then(want interactor.Response) ThenFn
Then asserts that the expected response is returned.
func ThenFailWith ¶
ThenFailWith asserts that the expected error occurred.
type WhenFn ¶
type WhenFn func(useCaseRunner interactor.UseCaseRunner) (interactor.Response, error)
WhenFn is a use case runner function.
func When ¶
func When(ctx context.Context, req interactor.Request, res interactor.Response) WhenFn
When runs the use case.
Click to show internal directories.
Click to hide internal directories.