mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-12 17:22:38 +02:00
test(web): add chat-stream helper, thread fixture, and smoke spec
This commit is contained in:
parent
55c33ca1c8
commit
dedccd5c1c
4 changed files with 148 additions and 1 deletions
32
surfsense_web/tests/smoke/chat-stream.spec.ts
Normal file
32
surfsense_web/tests/smoke/chat-stream.spec.ts
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import { expect, test } from "../fixtures";
|
||||
import { authHeaders, BACKEND_URL } from "../helpers/api/auth";
|
||||
import { streamChatToCompletion } from "../helpers/api/chat";
|
||||
|
||||
test.describe("Smoke", () => {
|
||||
test("chat stream completes for an unrelated query", async ({
|
||||
request,
|
||||
apiToken,
|
||||
searchSpace,
|
||||
}) => {
|
||||
const threadResponse = await request.post(`${BACKEND_URL}/api/v1/threads`, {
|
||||
headers: authHeaders(apiToken),
|
||||
data: {
|
||||
title: "e2e-chat-stream-smoke",
|
||||
search_space_id: searchSpace.id,
|
||||
visibility: "PRIVATE",
|
||||
},
|
||||
});
|
||||
expect(threadResponse.ok()).toBeTruthy();
|
||||
|
||||
const thread = (await threadResponse.json()) as { id: number };
|
||||
const chat = await streamChatToCompletion(request, apiToken, {
|
||||
searchSpaceId: searchSpace.id,
|
||||
threadId: thread.id,
|
||||
query: "E2E_NO_RELEVANT_CONTENT_SMOKE",
|
||||
});
|
||||
|
||||
expect(chat.events.some((event) => event.type === "done")).toBeTruthy();
|
||||
expect(chat.events.some((event) => event.type === "text-delta")).toBeTruthy();
|
||||
expect(chat.assistantText).toContain("No relevant indexed content found.");
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue