Replace AddHandler with AddHandlerCtx in tests (#42585)

This commit is contained in:
idafurjes
2021-12-01 15:43:31 +01:00
committed by GitHub
parent 2e3fd9d659
commit e6123bc3ef
37 changed files with 173 additions and 162 deletions

View File

@@ -18,7 +18,7 @@ func TestDispatch(t *testing.T) {
var invoked bool
bus.AddHandler(func(query *testQuery) error {
bus.AddHandlerCtx(func(ctx context.Context, query *testQuery) error {
invoked = true
return nil
})
@@ -74,7 +74,7 @@ func TestDispatchCtx_NoContextHandler(t *testing.T) {
var invoked bool
bus.AddHandler(func(query *testQuery) error {
bus.AddHandlerCtx(func(ctx context.Context, query *testQuery) error {
invoked = true
return nil
})
@@ -98,7 +98,7 @@ func TestQuery(t *testing.T) {
want := "hello from handler"
bus.AddHandler(func(q *testQuery) error {
bus.AddHandlerCtx(func(ctx context.Context, q *testQuery) error {
q.Resp = want
return nil
})
@@ -114,7 +114,7 @@ func TestQuery(t *testing.T) {
func TestQuery_HandlerReturnsError(t *testing.T) {
bus := New()
bus.AddHandler(func(query *testQuery) error {
bus.AddHandlerCtx(func(ctx context.Context, query *testQuery) error {
return errors.New("handler error")
})