From 0246b1bc4398604b86ba1f79b1832557d823e9a9 Mon Sep 17 00:00:00 2001 From: "sp.wack" <83104063+amanape@users.noreply.github.com> Date: Fri, 19 Dec 2025 21:00:59 +0400 Subject: [PATCH] hotfix(frontend): update websocket handler test mocks to use correct event count endpoint (#12104) --- .../conversation-websocket-handler.test.tsx | 48 +++++-------------- 1 file changed, 12 insertions(+), 36 deletions(-) diff --git a/frontend/__tests__/conversation-websocket-handler.test.tsx b/frontend/__tests__/conversation-websocket-handler.test.tsx index 0a8050eca8..d3df1676fa 100644 --- a/frontend/__tests__/conversation-websocket-handler.test.tsx +++ b/frontend/__tests__/conversation-websocket-handler.test.tsx @@ -453,18 +453,10 @@ describe("Conversation WebSocket Handler", () => { // Set up MSW to mock both the HTTP API and WebSocket connection mswServer.use( - http.get("/api/v1/events/count", ({ request }) => { - const url = new URL(request.url); - const conversationIdParam = url.searchParams.get( - "conversation_id__eq", - ); - - if (conversationIdParam === conversationId) { - return HttpResponse.json(expectedEventCount); - } - - return HttpResponse.json(0); - }), + http.get( + `http://localhost:3000/api/conversations/${conversationId}/events/count`, + () => HttpResponse.json(expectedEventCount), + ), wsLink.addEventListener("connection", ({ client, server }) => { server.connect(); // Send all history events @@ -520,18 +512,10 @@ describe("Conversation WebSocket Handler", () => { // Set up MSW to mock both the HTTP API and WebSocket connection mswServer.use( - http.get("/api/v1/events/count", ({ request }) => { - const url = new URL(request.url); - const conversationIdParam = url.searchParams.get( - "conversation_id__eq", - ); - - if (conversationIdParam === conversationId) { - return HttpResponse.json(0); - } - - return HttpResponse.json(0); - }), + http.get( + `http://localhost:3000/api/conversations/${conversationId}/events/count`, + () => HttpResponse.json(0), + ), wsLink.addEventListener("connection", ({ server }) => { server.connect(); // No events sent for empty history @@ -577,18 +561,10 @@ describe("Conversation WebSocket Handler", () => { // Set up MSW to mock both the HTTP API and WebSocket connection mswServer.use( - http.get("/api/v1/events/count", ({ request }) => { - const url = new URL(request.url); - const conversationIdParam = url.searchParams.get( - "conversation_id__eq", - ); - - if (conversationIdParam === conversationId) { - return HttpResponse.json(expectedEventCount); - } - - return HttpResponse.json(0); - }), + http.get( + `http://localhost:3000/api/conversations/${conversationId}/events/count`, + () => HttpResponse.json(expectedEventCount), + ), wsLink.addEventListener("connection", ({ client, server }) => { server.connect(); // Send all history events