mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
hotfix(frontend): update websocket handler test mocks to use correct event count endpoint (#12104)
This commit is contained in:
parent
f870246c3d
commit
0246b1bc43
@ -453,18 +453,10 @@ describe("Conversation WebSocket Handler", () => {
|
|||||||
|
|
||||||
// Set up MSW to mock both the HTTP API and WebSocket connection
|
// Set up MSW to mock both the HTTP API and WebSocket connection
|
||||||
mswServer.use(
|
mswServer.use(
|
||||||
http.get("/api/v1/events/count", ({ request }) => {
|
http.get(
|
||||||
const url = new URL(request.url);
|
`http://localhost:3000/api/conversations/${conversationId}/events/count`,
|
||||||
const conversationIdParam = url.searchParams.get(
|
() => HttpResponse.json(expectedEventCount),
|
||||||
"conversation_id__eq",
|
),
|
||||||
);
|
|
||||||
|
|
||||||
if (conversationIdParam === conversationId) {
|
|
||||||
return HttpResponse.json(expectedEventCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
return HttpResponse.json(0);
|
|
||||||
}),
|
|
||||||
wsLink.addEventListener("connection", ({ client, server }) => {
|
wsLink.addEventListener("connection", ({ client, server }) => {
|
||||||
server.connect();
|
server.connect();
|
||||||
// Send all history events
|
// Send all history events
|
||||||
@ -520,18 +512,10 @@ describe("Conversation WebSocket Handler", () => {
|
|||||||
|
|
||||||
// Set up MSW to mock both the HTTP API and WebSocket connection
|
// Set up MSW to mock both the HTTP API and WebSocket connection
|
||||||
mswServer.use(
|
mswServer.use(
|
||||||
http.get("/api/v1/events/count", ({ request }) => {
|
http.get(
|
||||||
const url = new URL(request.url);
|
`http://localhost:3000/api/conversations/${conversationId}/events/count`,
|
||||||
const conversationIdParam = url.searchParams.get(
|
() => HttpResponse.json(0),
|
||||||
"conversation_id__eq",
|
),
|
||||||
);
|
|
||||||
|
|
||||||
if (conversationIdParam === conversationId) {
|
|
||||||
return HttpResponse.json(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return HttpResponse.json(0);
|
|
||||||
}),
|
|
||||||
wsLink.addEventListener("connection", ({ server }) => {
|
wsLink.addEventListener("connection", ({ server }) => {
|
||||||
server.connect();
|
server.connect();
|
||||||
// No events sent for empty history
|
// 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
|
// Set up MSW to mock both the HTTP API and WebSocket connection
|
||||||
mswServer.use(
|
mswServer.use(
|
||||||
http.get("/api/v1/events/count", ({ request }) => {
|
http.get(
|
||||||
const url = new URL(request.url);
|
`http://localhost:3000/api/conversations/${conversationId}/events/count`,
|
||||||
const conversationIdParam = url.searchParams.get(
|
() => HttpResponse.json(expectedEventCount),
|
||||||
"conversation_id__eq",
|
),
|
||||||
);
|
|
||||||
|
|
||||||
if (conversationIdParam === conversationId) {
|
|
||||||
return HttpResponse.json(expectedEventCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
return HttpResponse.json(0);
|
|
||||||
}),
|
|
||||||
wsLink.addEventListener("connection", ({ client, server }) => {
|
wsLink.addEventListener("connection", ({ client, server }) => {
|
||||||
server.connect();
|
server.connect();
|
||||||
// Send all history events
|
// Send all history events
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user