From 154f2f7e542048f639ce5ba8630665c253aca613 Mon Sep 17 00:00:00 2001 From: Kirill Sysoev Date: Sun, 9 Jun 2024 19:34:20 +0800 Subject: [PATCH] Refactor router dispatcher tests to include context parameter --- dispatch/router_dipatcher_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dispatch/router_dipatcher_test.go b/dispatch/router_dipatcher_test.go index b13de0d..ca8f66e 100644 --- a/dispatch/router_dipatcher_test.go +++ b/dispatch/router_dipatcher_test.go @@ -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 @@ -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 @@ -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) @@ -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"