Skip to content

Commit b0b3af4

Browse files
committed
style: format integration test files
1 parent b69ac08 commit b0b3af4

File tree

5 files changed

+224
-149
lines changed

5 files changed

+224
-149
lines changed

tests/ipcMain/sendMessage.basic.test.ts

Lines changed: 40 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,17 @@ const PROVIDER_CONFIGS: Array<[string, string]> = [
4747
// - Longer running tests (tool calls, multiple edits) can take up to 30s
4848
// - Test timeout values (in describe/test) should be 2-3x the expected duration
4949

50-
let sharedRepoPath: string;
50+
let sharedRepoPath: string;
5151

52-
beforeAll(async () => {
53-
sharedRepoPath = await createTempGitRepo();
54-
});
52+
beforeAll(async () => {
53+
sharedRepoPath = await createTempGitRepo();
54+
});
5555

56-
afterAll(async () => {
57-
if (sharedRepoPath) {
58-
await cleanupTempGitRepo(sharedRepoPath);
59-
}
60-
});
56+
afterAll(async () => {
57+
if (sharedRepoPath) {
58+
await cleanupTempGitRepo(sharedRepoPath);
59+
}
60+
});
6161
describeIntegration("IpcMain sendMessage integration tests", () => {
6262
configureTestRetries(3);
6363

@@ -67,7 +67,11 @@ describeIntegration("IpcMain sendMessage integration tests", () => {
6767
"should successfully send message and receive response",
6868
async () => {
6969
// Setup test environment
70-
const { env, workspaceId, cleanup } = await setupWorkspace(provider, undefined, sharedRepoPath);
70+
const { env, workspaceId, cleanup } = await setupWorkspace(
71+
provider,
72+
undefined,
73+
sharedRepoPath
74+
);
7175
try {
7276
// Send a simple message
7377
const result = await sendMessageWithModel(
@@ -101,7 +105,11 @@ describeIntegration("IpcMain sendMessage integration tests", () => {
101105
"should interrupt streaming with interruptStream()",
102106
async () => {
103107
// Setup test environment
104-
const { env, workspaceId, cleanup } = await setupWorkspace(provider, undefined, sharedRepoPath);
108+
const { env, workspaceId, cleanup } = await setupWorkspace(
109+
provider,
110+
undefined,
111+
sharedRepoPath
112+
);
105113
try {
106114
// Start a long-running stream with a bash command that takes time
107115
const longMessage = "Run this bash command: while true; do sleep 1; done";
@@ -147,7 +155,11 @@ describeIntegration("IpcMain sendMessage integration tests", () => {
147155
"should interrupt stream with pending bash tool call near-instantly",
148156
async () => {
149157
// Setup test environment
150-
const { env, workspaceId, cleanup } = await setupWorkspace(provider, undefined, sharedRepoPath);
158+
const { env, workspaceId, cleanup } = await setupWorkspace(
159+
provider,
160+
undefined,
161+
sharedRepoPath
162+
);
151163
try {
152164
// Ask the model to run a long-running bash command
153165
// Use explicit instruction to ensure tool call happens
@@ -207,7 +219,11 @@ describeIntegration("IpcMain sendMessage integration tests", () => {
207219
"should include tokens and timestamp in delta events",
208220
async () => {
209221
// Setup test environment
210-
const { env, workspaceId, cleanup } = await setupWorkspace(provider, undefined, sharedRepoPath);
222+
const { env, workspaceId, cleanup } = await setupWorkspace(
223+
provider,
224+
undefined,
225+
sharedRepoPath
226+
);
211227
try {
212228
// Send a message that will generate text deltas
213229
// Disable reasoning for this test to avoid flakiness and encrypted content issues in CI
@@ -282,7 +298,11 @@ describeIntegration("IpcMain sendMessage integration tests", () => {
282298
"should include usage data in stream-abort events",
283299
async () => {
284300
// Setup test environment
285-
const { env, workspaceId, cleanup } = await setupWorkspace(provider, undefined, sharedRepoPath);
301+
const { env, workspaceId, cleanup } = await setupWorkspace(
302+
provider,
303+
undefined,
304+
sharedRepoPath
305+
);
286306
try {
287307
// Start a stream that will generate some tokens
288308
const message = "Write a haiku about coding";
@@ -348,7 +368,11 @@ describeIntegration("IpcMain sendMessage integration tests", () => {
348368
return;
349369
}
350370

351-
const { env, workspaceId, cleanup } = await setupWorkspace(provider, undefined, sharedRepoPath);
371+
const { env, workspaceId, cleanup } = await setupWorkspace(
372+
provider,
373+
undefined,
374+
sharedRepoPath
375+
);
352376
try {
353377
// Start a stream with tool call that takes a long time
354378
void sendMessageWithModel(
@@ -438,7 +462,6 @@ describeIntegration("IpcMain sendMessage integration tests", () => {
438462
},
439463
15000
440464
);
441-
442465
});
443466

444467
// Test frontend metadata round-trip (no provider needed - just verifies storage)
@@ -509,5 +532,4 @@ describeIntegration("IpcMain sendMessage integration tests", () => {
509532
});
510533

511534
// Test image support across providers
512-
describe.each(PROVIDER_CONFIGS)("%s:%s image support", (provider, model) => {
513-
});
535+
describe.each(PROVIDER_CONFIGS)("%s:%s image support", (provider, model) => {});

tests/ipcMain/sendMessage.context.test.ts

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,17 @@ const PROVIDER_CONFIGS: Array<[string, string]> = [
4747
// - Longer running tests (tool calls, multiple edits) can take up to 30s
4848
// - Test timeout values (in describe/test) should be 2-3x the expected duration
4949

50-
let sharedRepoPath: string;
50+
let sharedRepoPath: string;
5151

52-
beforeAll(async () => {
53-
sharedRepoPath = await createTempGitRepo();
54-
});
52+
beforeAll(async () => {
53+
sharedRepoPath = await createTempGitRepo();
54+
});
5555

56-
afterAll(async () => {
57-
if (sharedRepoPath) {
58-
await cleanupTempGitRepo(sharedRepoPath);
59-
}
60-
});
56+
afterAll(async () => {
57+
if (sharedRepoPath) {
58+
await cleanupTempGitRepo(sharedRepoPath);
59+
}
60+
});
6161
describeIntegration("IpcMain sendMessage integration tests", () => {
6262
configureTestRetries(3);
6363

@@ -66,7 +66,11 @@ describeIntegration("IpcMain sendMessage integration tests", () => {
6666
test.concurrent(
6767
"should handle message editing with history truncation",
6868
async () => {
69-
const { env, workspaceId, cleanup } = await setupWorkspace(provider, undefined, sharedRepoPath);
69+
const { env, workspaceId, cleanup } = await setupWorkspace(
70+
provider,
71+
undefined,
72+
sharedRepoPath
73+
);
7074
try {
7175
// Send first message
7276
const result1 = await sendMessageWithModel(
@@ -112,7 +116,11 @@ describeIntegration("IpcMain sendMessage integration tests", () => {
112116
test.concurrent(
113117
"should handle message editing during active stream with tool calls",
114118
async () => {
115-
const { env, workspaceId, cleanup } = await setupWorkspace(provider, undefined, sharedRepoPath);
119+
const { env, workspaceId, cleanup } = await setupWorkspace(
120+
provider,
121+
undefined,
122+
sharedRepoPath
123+
);
116124
try {
117125
// Send a message that will trigger a long-running tool call
118126
const result1 = await sendMessageWithModel(
@@ -231,7 +239,11 @@ describeIntegration("IpcMain sendMessage integration tests", () => {
231239
test.concurrent(
232240
"should maintain conversation continuity across messages",
233241
async () => {
234-
const { env, workspaceId, cleanup } = await setupWorkspace(provider, undefined, sharedRepoPath);
242+
const { env, workspaceId, cleanup } = await setupWorkspace(
243+
provider,
244+
undefined,
245+
sharedRepoPath
246+
);
235247
try {
236248
// First message: Ask for a random word
237249
const result1 = await sendMessageWithModel(
@@ -405,7 +417,11 @@ These are general instructions that apply to all modes.
405417

406418
for (const [provider, model] of PROVIDER_CONFIGS) {
407419
// Create fresh environment with provider setup
408-
const { env, workspaceId, cleanup } = await setupWorkspace(provider, undefined, sharedRepoPath);
420+
const { env, workspaceId, cleanup } = await setupWorkspace(
421+
provider,
422+
undefined,
423+
sharedRepoPath
424+
);
409425

410426
// Send same message to both providers
411427
const result = await sendMessageWithModel(
@@ -473,7 +489,11 @@ These are general instructions that apply to all modes.
473489
test.each(PROVIDER_CONFIGS)(
474490
"%s should pass additionalSystemInstructions through to system message",
475491
async (provider, model) => {
476-
const { env, workspaceId, cleanup } = await setupWorkspace(provider, undefined, sharedRepoPath);
492+
const { env, workspaceId, cleanup } = await setupWorkspace(
493+
provider,
494+
undefined,
495+
sharedRepoPath
496+
);
477497
try {
478498
// Send message with custom system instructions that add a distinctive marker
479499
const result = await sendMessage(env.mockIpcRenderer, workspaceId, "Say hello", {
@@ -516,7 +536,6 @@ These are general instructions that apply to all modes.
516536
const provider = "openai";
517537
const model = "gpt-4o-mini";
518538

519-
520539
test.each(PROVIDER_CONFIGS)(
521540
"%s should include full file_edit diff in UI/history but redact it from the next provider request",
522541
async (provider, model) => {

tests/ipcMain/sendMessage.errors.test.ts

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,17 @@ const PROVIDER_CONFIGS: Array<[string, string]> = [
4747
// - Longer running tests (tool calls, multiple edits) can take up to 30s
4848
// - Test timeout values (in describe/test) should be 2-3x the expected duration
4949

50-
let sharedRepoPath: string;
50+
let sharedRepoPath: string;
5151

52-
beforeAll(async () => {
53-
sharedRepoPath = await createTempGitRepo();
54-
});
52+
beforeAll(async () => {
53+
sharedRepoPath = await createTempGitRepo();
54+
});
5555

56-
afterAll(async () => {
57-
if (sharedRepoPath) {
58-
await cleanupTempGitRepo(sharedRepoPath);
59-
}
60-
});
56+
afterAll(async () => {
57+
if (sharedRepoPath) {
58+
await cleanupTempGitRepo(sharedRepoPath);
59+
}
60+
});
6161
describeIntegration("IpcMain sendMessage integration tests", () => {
6262
configureTestRetries(3);
6363

@@ -66,7 +66,11 @@ describeIntegration("IpcMain sendMessage integration tests", () => {
6666
test.concurrent(
6767
"should reject empty message (use interruptStream instead)",
6868
async () => {
69-
const { env, workspaceId, cleanup } = await setupWorkspace(provider, undefined, sharedRepoPath);
69+
const { env, workspaceId, cleanup } = await setupWorkspace(
70+
provider,
71+
undefined,
72+
sharedRepoPath
73+
);
7074
try {
7175
// Send empty message without any active stream
7276
const result = await sendMessageWithModel(
@@ -101,7 +105,11 @@ describeIntegration("IpcMain sendMessage integration tests", () => {
101105
);
102106

103107
test.concurrent("should return error when model is not provided", async () => {
104-
const { env, workspaceId, cleanup } = await setupWorkspace(provider, undefined, sharedRepoPath);
108+
const { env, workspaceId, cleanup } = await setupWorkspace(
109+
provider,
110+
undefined,
111+
sharedRepoPath
112+
);
105113
try {
106114
// Send message without model
107115
const result = await sendMessage(
@@ -122,7 +130,11 @@ describeIntegration("IpcMain sendMessage integration tests", () => {
122130
});
123131

124132
test.concurrent("should return error for invalid model string", async () => {
125-
const { env, workspaceId, cleanup } = await setupWorkspace(provider, undefined, sharedRepoPath);
133+
const { env, workspaceId, cleanup } = await setupWorkspace(
134+
provider,
135+
undefined,
136+
sharedRepoPath
137+
);
126138
try {
127139
// Send message with invalid model format
128140
const result = await sendMessage(env.mockIpcRenderer, workspaceId, "Hello", {
@@ -139,7 +151,11 @@ describeIntegration("IpcMain sendMessage integration tests", () => {
139151
test.each(PROVIDER_CONFIGS)(
140152
"%s should return stream error when model does not exist",
141153
async (provider) => {
142-
const { env, workspaceId, cleanup } = await setupWorkspace(provider, undefined, sharedRepoPath);
154+
const { env, workspaceId, cleanup } = await setupWorkspace(
155+
provider,
156+
undefined,
157+
sharedRepoPath
158+
);
143159
try {
144160
// Use a clearly non-existent model name
145161
const nonExistentModel = "definitely-not-a-real-model-12345";
@@ -185,7 +201,11 @@ describeIntegration("IpcMain sendMessage integration tests", () => {
185201
test.each(PROVIDER_CONFIGS)(
186202
"%s should return error when accumulated history exceeds token limit",
187203
async (provider, model) => {
188-
const { env, workspaceId, cleanup } = await setupWorkspace(provider, undefined, sharedRepoPath);
204+
const { env, workspaceId, cleanup } = await setupWorkspace(
205+
provider,
206+
undefined,
207+
sharedRepoPath
208+
);
189209
try {
190210
// Build up large conversation history to exceed context limits
191211
// Different providers have different limits:
@@ -459,8 +479,7 @@ describeIntegration("IpcMain sendMessage integration tests", () => {
459479
});
460480

461481
// Additional system instructions tests
462-
describe("additional system instructions", () => {
463-
});
482+
describe("additional system instructions", () => {});
464483

465484
// Test frontend metadata round-trip (no provider needed - just verifies storage)
466485
});

tests/ipcMain/sendMessage.heavy.test.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,17 @@ const PROVIDER_CONFIGS: Array<[string, string]> = [
4747
// - Longer running tests (tool calls, multiple edits) can take up to 30s
4848
// - Test timeout values (in describe/test) should be 2-3x the expected duration
4949

50-
let sharedRepoPath: string;
50+
let sharedRepoPath: string;
5151

52-
beforeAll(async () => {
53-
sharedRepoPath = await createTempGitRepo();
54-
});
52+
beforeAll(async () => {
53+
sharedRepoPath = await createTempGitRepo();
54+
});
5555

56-
afterAll(async () => {
57-
if (sharedRepoPath) {
58-
await cleanupTempGitRepo(sharedRepoPath);
59-
}
60-
});
56+
afterAll(async () => {
57+
if (sharedRepoPath) {
58+
await cleanupTempGitRepo(sharedRepoPath);
59+
}
60+
});
6161
describeIntegration("IpcMain sendMessage integration tests", () => {
6262
configureTestRetries(3);
6363

@@ -69,7 +69,11 @@ describeIntegration("IpcMain sendMessage integration tests", () => {
6969
test.concurrent(
7070
"respects disableAutoTruncation flag",
7171
async () => {
72-
const { env, workspaceId, cleanup } = await setupWorkspace(provider, undefined, sharedRepoPath);
72+
const { env, workspaceId, cleanup } = await setupWorkspace(
73+
provider,
74+
undefined,
75+
sharedRepoPath
76+
);
7377

7478
try {
7579
// Phase 1: Build up large conversation history to exceed context limit
@@ -145,6 +149,5 @@ describeIntegration("IpcMain sendMessage integration tests", () => {
145149
},
146150
60000 // 1 minute timeout (much faster since we don't make many API calls)
147151
);
148-
149152
});
150153
});

0 commit comments

Comments
 (0)