Skip to content

Commit 7c7a7fd

Browse files
committed
test: align nitpick test conventions
1 parent 0591063 commit 7c7a7fd

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

src/mcp/tools/macos/__tests__/build_run_macos.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
import { describe, it, expect, beforeEach } from 'vitest';
2-
import type { ChildProcess } from 'child_process';
32
import * as z from 'zod';
4-
import { createMockExecutor } from '../../../../test-utils/mock-executors.ts';
3+
import { createMockExecutor, mockProcess } from '../../../../test-utils/mock-executors.ts';
54
import { sessionStore } from '../../../../utils/session-store.ts';
65
import tool, { buildRunMacOSLogic } from '../build_run_macos.ts';
76

8-
const mockProcess = { pid: 12345 } as unknown as ChildProcess;
9-
107
describe('build_run_macos', () => {
118
beforeEach(() => {
129
sessionStore.clear();

src/mcp/tools/session-management/__tests__/session_show_defaults.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ describe('session-show-defaults tool', () => {
3333
it('should return empty defaults when none set', async () => {
3434
const result = await plugin.handler();
3535
expect(result.isError).toBe(false);
36+
expect(result.content).toHaveLength(1);
37+
expect(typeof result.content[0].text).toBe('string');
3638
const parsed = JSON.parse(result.content[0].text as string);
3739
expect(parsed).toEqual({});
3840
});
@@ -41,6 +43,8 @@ describe('session-show-defaults tool', () => {
4143
sessionStore.setDefaults({ scheme: 'MyScheme', simulatorId: 'SIM-123' });
4244
const result = await plugin.handler();
4345
expect(result.isError).toBe(false);
46+
expect(result.content).toHaveLength(1);
47+
expect(typeof result.content[0].text).toBe('string');
4448
const parsed = JSON.parse(result.content[0].text as string);
4549
expect(parsed.scheme).toBe('MyScheme');
4650
expect(parsed.simulatorId).toBe('SIM-123');

src/mcp/tools/ui-testing/__tests__/key_press.test.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import { describe, it, expect, beforeEach } from 'vitest';
66
import * as z from 'zod';
77
import {
8+
createMockCommandResponse,
89
createMockExecutor,
910
createMockFileSystemExecutor,
1011
createNoopExecutor,
@@ -81,12 +82,12 @@ describe('Key Press Plugin', () => {
8182
let capturedCommand: string[] = [];
8283
const trackingExecutor = async (command: string[]) => {
8384
capturedCommand = command;
84-
return {
85+
return createMockCommandResponse({
8586
success: true,
8687
output: 'key press completed',
8788
error: undefined,
8889
process: mockProcess,
89-
};
90+
});
9091
};
9192

9293
const mockAxeHelpers = {
@@ -125,12 +126,12 @@ describe('Key Press Plugin', () => {
125126
let capturedCommand: string[] = [];
126127
const trackingExecutor = async (command: string[]) => {
127128
capturedCommand = command;
128-
return {
129+
return createMockCommandResponse({
129130
success: true,
130131
output: 'key press completed',
131132
error: undefined,
132133
process: mockProcess,
133-
};
134+
});
134135
};
135136

136137
const mockAxeHelpers = {
@@ -172,12 +173,12 @@ describe('Key Press Plugin', () => {
172173
let capturedCommand: string[] = [];
173174
const trackingExecutor = async (command: string[]) => {
174175
capturedCommand = command;
175-
return {
176+
return createMockCommandResponse({
176177
success: true,
177178
output: 'key press completed',
178179
error: undefined,
179180
process: mockProcess,
180-
};
181+
});
181182
};
182183

183184
const mockAxeHelpers = {
@@ -216,12 +217,12 @@ describe('Key Press Plugin', () => {
216217
let capturedCommand: string[] = [];
217218
const trackingExecutor = async (command: string[]) => {
218219
capturedCommand = command;
219-
return {
220+
return createMockCommandResponse({
220221
success: true,
221222
output: 'key press completed',
222223
error: undefined,
223224
process: mockProcess,
224-
};
225+
});
225226
};
226227

227228
const mockAxeHelpers = {

0 commit comments

Comments
 (0)