Skip to content

Commit b615abb

Browse files
Address PR review feedback
- Remove unused 'answer' variable in Python streaming fidelity test - Add onTestFinished cleanup for newClient in Node.js streaming resume test - Remove streaming tests from Node.js session.test.ts (were still referencing deleted session/ snapshots) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 3c6e73f commit b615abb

File tree

3 files changed

+3
-52
lines changed

3 files changed

+3
-52
lines changed

nodejs/test/e2e/session.test.ts

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -296,56 +296,6 @@ describe("Sessions", async () => {
296296
expect(answer?.data.content).toContain("4");
297297
});
298298

299-
it("should receive streaming delta events when streaming is enabled", async () => {
300-
const session = await client.createSession({
301-
onPermissionRequest: approveAll,
302-
streaming: true,
303-
});
304-
305-
const deltaContents: string[] = [];
306-
let _finalMessage: string | undefined;
307-
308-
// Set up event listener before sending
309-
const unsubscribe = session.on((event) => {
310-
if (event.type === "assistant.message_delta") {
311-
const delta = (event.data as { deltaContent?: string }).deltaContent;
312-
if (delta) {
313-
deltaContents.push(delta);
314-
}
315-
} else if (event.type === "assistant.message") {
316-
_finalMessage = event.data.content;
317-
}
318-
});
319-
320-
const assistantMessage = await session.sendAndWait({ prompt: "What is 2+2?" });
321-
322-
unsubscribe();
323-
324-
// Should have received delta events
325-
expect(deltaContents.length).toBeGreaterThan(0);
326-
327-
// Accumulated deltas should equal the final message
328-
const accumulated = deltaContents.join("");
329-
expect(accumulated).toBe(assistantMessage?.data.content);
330-
331-
// Final message should contain the answer
332-
expect(assistantMessage?.data.content).toContain("4");
333-
});
334-
335-
it("should pass streaming option to session creation", async () => {
336-
// Verify that the streaming option is accepted without errors
337-
const session = await client.createSession({
338-
onPermissionRequest: approveAll,
339-
streaming: true,
340-
});
341-
342-
expect(session.sessionId).toMatch(/^[a-f0-9-]+$/);
343-
344-
// Session should still work normally
345-
const assistantMessage = await session.sendAndWait({ prompt: "What is 1+1?" });
346-
expect(assistantMessage?.data.content).toContain("2");
347-
});
348-
349299
it("should receive session events", async () => {
350300
const session = await client.createSession({ onPermissionRequest: approveAll });
351301
const receivedEvents: Array<{ type: string }> = [];

nodejs/test/e2e/streaming_fidelity.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Copyright (c) Microsoft Corporation. All rights reserved.
33
*--------------------------------------------------------------------------------------------*/
44

5-
import { describe, expect, it } from "vitest";
5+
import { describe, expect, it, onTestFinished } from "vitest";
66
import { CopilotClient, SessionEvent, approveAll } from "../../src/index.js";
77
import { createSdkTestContext, isCI } from "./harness/sdkTestContext";
88

@@ -85,6 +85,7 @@ describe("Streaming Fidelity", async () => {
8585
env,
8686
githubToken: isCI ? "fake-token-for-e2e-tests" : undefined,
8787
});
88+
onTestFinished(() => newClient.forceStop());
8889
const session2 = await newClient.resumeSession(session.sessionId, {
8990
onPermissionRequest: approveAll,
9091
streaming: true,

python/e2e/test_streaming_fidelity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ async def test_should_produce_delta_events_when_streaming_is_enabled(
2222
events = []
2323
session.on(lambda event: events.append(event))
2424

25-
answer = await session.send_and_wait(
25+
await session.send_and_wait(
2626
{"prompt": "Count from 1 to 5, separated by commas."}
2727
)
2828

0 commit comments

Comments
 (0)