-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelpers_test.go
58 lines (40 loc) · 1.14 KB
/
helpers_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package interactor_test
import (
"context"
"errors"
)
var errSomeErr = errors.New("some error")
type TestRequest struct {
id int
}
type TestResponse struct {
result int
}
type ConcreteUseCase struct {
err error
}
func (i ConcreteUseCase) Run(_ context.Context, req TestRequest, res *TestResponse) error {
res.result = req.id
return i.err
}
type AnotherResponse struct{}
type InvalidUseCaseWrongSignature struct{}
func (i InvalidUseCaseWrongSignature) Run(ctx context.Context, req TestRequest) error {
return nil
}
type InvalidUseCaseWrongContext struct{}
func (i InvalidUseCaseWrongContext) Run(ctx struct{}, req TestRequest, resp *TestResponse) error {
return nil
}
type InvalidUseCaseWrongRequest struct{}
func (i InvalidUseCaseWrongRequest) Run(ctx context.Context, req int, resp *TestResponse) error {
return nil
}
type ValidUseCasePointerRequest struct{}
func (i ValidUseCasePointerRequest) Run(ctx context.Context, req *TestRequest, resp *TestResponse) error {
return nil
}
type InvalidUseCaseWrongResponse struct{}
func (i InvalidUseCaseWrongResponse) Run(ctx context.Context, req TestRequest, resp struct{}) error {
return nil
}