Skip to content

Commit

Permalink
Refactor router dispatcher tests to include context parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
ksysoev committed Jun 9, 2024
1 parent df2bee9 commit 154f2f7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions dispatch/router_dipatcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ func TestRouterDispatcher_DispatchDefaultBackend(t *testing.T) {
dispatcher := NewRouterDispatcher(defaultBackend, parser)

conn := mocks.NewMockConnection(t)
conn.EXPECT().Context().Return(context.Background())

data := []byte("test data")

// Test case 1: Request with existing routing key
Expand All @@ -89,6 +91,8 @@ func TestRouterDispatcher_DispatchByRoutingKey(t *testing.T) {
dispatcher := NewRouterDispatcher(defaultBackend, parser)

conn := mocks.NewMockConnection(t)
conn.EXPECT().Context().Return(context.Background())

data := []byte("test data")

// Test case 1: Request with existing routing key
Expand All @@ -110,6 +114,8 @@ func TestRouterDispatcher_DispatchWrongRequest(t *testing.T) {
dispatcher := NewRouterDispatcher(defaultBackend, parser)

conn := mocks.NewMockConnection(t)
conn.EXPECT().Context().Return(context.Background())

data := []byte("test data")

dispatcher.Dispatch(conn, wasabi.MsgTypeText, data)
Expand All @@ -124,6 +130,8 @@ func TestRouterDispatcher_DispatchErrorHandlingRequest(t *testing.T) {
dispatcher := NewRouterDispatcher(defaultBackend, parser)

conn := mocks.NewMockConnection(t)
conn.EXPECT().Context().Return(context.Background())

data := []byte("test data")

routingKey := "key1"
Expand Down

0 comments on commit 154f2f7

Please sign in to comment.