Skip to content

Commit 5f9c460

Browse files
committed
fix lint/format
1 parent 779fe12 commit 5f9c460

6 files changed

Lines changed: 20 additions & 45 deletions

File tree

nodejs/test/e2e/builtin_tools.test.ts

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,10 @@ describe("Built-in Tools", async () => {
3131

3232
describe("view", () => {
3333
it("should read file with line range", async () => {
34-
await writeFile(
35-
join(workDir, "lines.txt"),
36-
"line1\nline2\nline3\nline4\nline5\n"
37-
);
34+
await writeFile(join(workDir, "lines.txt"), "line1\nline2\nline3\nline4\nline5\n");
3835
const session = await client.createSession();
3936
const msg = await session.sendAndWait({
40-
prompt:
41-
"Read lines 2 through 4 of the file 'lines.txt' in this directory. Tell me what those lines contain.",
37+
prompt: "Read lines 2 through 4 of the file 'lines.txt' in this directory. Tell me what those lines contain.",
4238
});
4339
expect(msg?.data.content).toContain("line2");
4440
expect(msg?.data.content).toContain("line4");
@@ -47,8 +43,7 @@ describe("Built-in Tools", async () => {
4743
it("should handle nonexistent file gracefully", async () => {
4844
const session = await client.createSession();
4945
const msg = await session.sendAndWait({
50-
prompt:
51-
"Try to read the file 'does_not_exist.txt'. If it doesn't exist, say 'FILE_NOT_FOUND'.",
46+
prompt: "Try to read the file 'does_not_exist.txt'. If it doesn't exist, say 'FILE_NOT_FOUND'.",
5247
});
5348
expect(msg?.data.content?.toUpperCase()).toMatch(
5449
/NOT.FOUND|NOT.EXIST|NO.SUCH|FILE_NOT_FOUND|DOES.NOT.EXIST|ERROR/i
@@ -61,8 +56,7 @@ describe("Built-in Tools", async () => {
6156
await writeFile(join(workDir, "edit_me.txt"), "Hello World\nGoodbye World\n");
6257
const session = await client.createSession();
6358
const msg = await session.sendAndWait({
64-
prompt:
65-
"Edit the file 'edit_me.txt': replace 'Hello World' with 'Hi Universe'. Then read it back and tell me its contents.",
59+
prompt: "Edit the file 'edit_me.txt': replace 'Hello World' with 'Hi Universe'. Then read it back and tell me its contents.",
6660
});
6761
expect(msg?.data.content).toContain("Hi Universe");
6862
});
@@ -72,8 +66,7 @@ describe("Built-in Tools", async () => {
7266
it("should create a new file", async () => {
7367
const session = await client.createSession();
7468
const msg = await session.sendAndWait({
75-
prompt:
76-
"Create a file called 'new_file.txt' with the content 'Created by test'. Then read it back to confirm.",
69+
prompt: "Create a file called 'new_file.txt' with the content 'Created by test'. Then read it back to confirm.",
7770
});
7871
expect(msg?.data.content).toContain("Created by test");
7972
});
@@ -84,8 +77,7 @@ describe("Built-in Tools", async () => {
8477
await writeFile(join(workDir, "data.txt"), "apple\nbanana\napricot\ncherry\n");
8578
const session = await client.createSession();
8679
const msg = await session.sendAndWait({
87-
prompt:
88-
"Search for lines starting with 'ap' in the file 'data.txt'. Tell me which lines matched.",
80+
prompt: "Search for lines starting with 'ap' in the file 'data.txt'. Tell me which lines matched.",
8981
});
9082
expect(msg?.data.content).toContain("apple");
9183
expect(msg?.data.content).toContain("apricot");
@@ -100,8 +92,7 @@ describe("Built-in Tools", async () => {
10092
await writeFile(join(workDir, "README.md"), "# Readme");
10193
const session = await client.createSession();
10294
const msg = await session.sendAndWait({
103-
prompt:
104-
"Find all .ts files in this directory (recursively). List the filenames you found.",
95+
prompt: "Find all .ts files in this directory (recursively). List the filenames you found.",
10596
});
10697
expect(msg?.data.content).toContain("app.ts");
10798
expect(msg?.data.content).toContain("index.ts");

nodejs/test/e2e/error_resilience.test.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ describe("Error Resilience", async () => {
1212
const session = await client.createSession();
1313
await session.destroy();
1414

15-
await expect(
16-
session.sendAndWait({ prompt: "Hello" })
17-
).rejects.toThrow();
15+
await expect(session.sendAndWait({ prompt: "Hello" })).rejects.toThrow();
1816
});
1917

2018
it("should throw when getting messages from destroyed session", async () => {
@@ -37,8 +35,6 @@ describe("Error Resilience", async () => {
3735
});
3836

3937
it("should throw when resuming non-existent session", async () => {
40-
await expect(
41-
client.resumeSession("non-existent-session-id-12345")
42-
).rejects.toThrow();
38+
await expect(client.resumeSession("non-existent-session-id-12345")).rejects.toThrow();
4339
});
4440
});

nodejs/test/e2e/event_fidelity.test.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,8 @@ describe("Event Fidelity", async () => {
9191
});
9292

9393
// Should have tool.execution_start and tool.execution_complete
94-
const toolStarts = events.filter(
95-
(e) => e.type === "tool.execution_start"
96-
);
97-
const toolCompletes = events.filter(
98-
(e) => e.type === "tool.execution_complete"
99-
);
94+
const toolStarts = events.filter((e) => e.type === "tool.execution_start");
95+
const toolCompletes = events.filter((e) => e.type === "tool.execution_complete");
10096

10197
expect(toolStarts.length).toBeGreaterThanOrEqual(1);
10298
expect(toolCompletes.length).toBeGreaterThanOrEqual(1);
@@ -124,9 +120,7 @@ describe("Event Fidelity", async () => {
124120
prompt: "Say 'pong'.",
125121
});
126122

127-
const assistantEvents = events.filter(
128-
(e) => e.type === "assistant.message"
129-
);
123+
const assistantEvents = events.filter((e) => e.type === "assistant.message");
130124
expect(assistantEvents.length).toBeGreaterThanOrEqual(1);
131125

132126
// messageId should be present

nodejs/test/e2e/hooks_extended.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
import { describe, expect, it } from "vitest";
66
import type {
7+
ErrorOccurredHookInput,
8+
SessionEndHookInput,
79
SessionStartHookInput,
810
UserPromptSubmittedHookInput,
9-
SessionEndHookInput,
10-
ErrorOccurredHookInput,
1111
} from "../../src/types.js";
1212
import { createSdkTestContext } from "./harness/sdkTestContext.js";
1313

1414
describe("Extended session hooks", async () => {
15-
const { copilotClient: client, workDir } = await createSdkTestContext();
15+
const { copilotClient: client } = await createSdkTestContext();
1616

1717
it("should invoke onSessionStart hook on new session", async () => {
1818
const sessionStartInputs: SessionStartHookInput[] = [];

nodejs/test/e2e/streaming_fidelity.test.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ describe("Streaming Fidelity", async () => {
2323
const types = events.map((e) => e.type);
2424

2525
// Should have streaming deltas before the final message
26-
const deltaEvents = events.filter(
27-
(e) => e.type === "assistant.message_delta"
28-
);
26+
const deltaEvents = events.filter((e) => e.type === "assistant.message_delta");
2927
expect(deltaEvents.length).toBeGreaterThanOrEqual(1);
3028

3129
// Deltas should have content
@@ -56,17 +54,13 @@ describe("Streaming Fidelity", async () => {
5654
prompt: "Say 'hello world'.",
5755
});
5856

59-
const deltaEvents = events.filter(
60-
(e) => e.type === "assistant.message_delta"
61-
);
57+
const deltaEvents = events.filter((e) => e.type === "assistant.message_delta");
6258

6359
// No deltas when streaming is off
6460
expect(deltaEvents.length).toBe(0);
6561

6662
// But should still have a final assistant.message
67-
const assistantEvents = events.filter(
68-
(e) => e.type === "assistant.message"
69-
);
63+
const assistantEvents = events.filter((e) => e.type === "assistant.message");
7064
expect(assistantEvents.length).toBeGreaterThanOrEqual(1);
7165

7266
await session.destroy();

nodejs/test/e2e/tool_results.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
import { describe, expect, it } from "vitest";
66
import { z } from "zod";
7-
import { defineTool } from "../../src/index.js";
87
import type { ToolResultObject } from "../../src/index.js";
8+
import { defineTool } from "../../src/index.js";
99
import { createSdkTestContext } from "./harness/sdkTestContext";
1010

1111
describe("Tool Results", async () => {
12-
const { copilotClient: client, openAiEndpoint } = await createSdkTestContext();
12+
const { copilotClient: client } = await createSdkTestContext();
1313

1414
it("should handle structured ToolResultObject from custom tool", async () => {
1515
const session = await client.createSession({

0 commit comments

Comments
 (0)