Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@
"lint:fix": "eslint 'src/**/*.{js,ts}' --fix",
"format": "prettier --write 'src/**/*.{js,ts}'",
"format:check": "prettier --check 'src/**/*.{js,ts}'",
"typecheck": "npx tsc --noEmit",
"typecheck:tests": "npx tsc -p tsconfig.tests.json --noEmit",
"typecheck:all": "npm run typecheck && npm run typecheck:tests",
"typecheck": "npx tsc --noEmit && npx tsc -p tsconfig.test.json",
"typecheck:tests": "npx tsc -p tsconfig.test.json",
"verify:smithery-bundle": "bash scripts/verify-smithery-bundle.sh",
"inspect": "npx @modelcontextprotocol/inspector node build/index.js",
"doctor": "node build/doctor-cli.js",
Expand Down
15 changes: 8 additions & 7 deletions src/mcp/resources/__tests__/simulators.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import { describe, it, expect, beforeEach } from 'vitest';
import * as z from 'zod';

import simulatorsResource, { simulatorsResourceLogic } from '../simulators.ts';
import { createMockExecutor } from '../../../test-utils/mock-executors.ts';
import {
createMockCommandResponse,
createMockExecutor,
} from '../../../test-utils/mock-executors.ts';

describe('simulators resource', () => {
describe('Export Field Validation', () => {
Expand Down Expand Up @@ -73,21 +76,19 @@ describe('simulators resource', () => {
const mockExecutor = async (command: string[]) => {
// JSON command returns invalid JSON
if (command.includes('--json')) {
return {
return createMockCommandResponse({
success: true,
output: 'invalid json',
error: undefined,
process: { pid: 12345 },
};
});
}

// Text command returns valid text output
return {
return createMockCommandResponse({
success: true,
output: mockTextOutput,
error: undefined,
process: { pid: 12345 },
};
});
};

const result = await simulatorsResourceLogic(mockExecutor);
Expand Down
48 changes: 26 additions & 22 deletions src/mcp/tools/device/__tests__/build_device.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@

import { describe, it, expect, beforeEach } from 'vitest';
import * as z from 'zod';
import { createMockExecutor, createNoopExecutor } from '../../../../test-utils/mock-executors.ts';
import {
createMockCommandResponse,
createMockExecutor,
createNoopExecutor,
} from '../../../../test-utils/mock-executors.ts';
import buildDevice, { buildDeviceLogic } from '../build_device.ts';
import { sessionStore } from '../../../../utils/session-store.ts';

Expand Down Expand Up @@ -130,24 +134,24 @@ describe('build_device plugin', () => {
it('should verify workspace command generation with mock executor', async () => {
const commandCalls: Array<{
args: string[];
logPrefix: string;
silent: boolean;
logPrefix?: string;
silent?: boolean;
opts: { cwd?: string } | undefined;
}> = [];

const stubExecutor = async (
args: string[],
logPrefix: string,
silent: boolean,
logPrefix?: string,
silent?: boolean,
opts?: { cwd?: string },
_detached?: boolean,
) => {
commandCalls.push({ args, logPrefix, silent, opts });
return {
return createMockCommandResponse({
success: true,
output: 'Build succeeded',
error: undefined,
process: { pid: 12345 },
};
});
};

await buildDeviceLogic(
Expand Down Expand Up @@ -182,24 +186,24 @@ describe('build_device plugin', () => {
it('should verify command generation with mock executor', async () => {
const commandCalls: Array<{
args: string[];
logPrefix: string;
silent: boolean;
logPrefix?: string;
silent?: boolean;
opts: { cwd?: string } | undefined;
}> = [];

const stubExecutor = async (
args: string[],
logPrefix: string,
silent: boolean,
logPrefix?: string,
silent?: boolean,
opts?: { cwd?: string },
_detached?: boolean,
) => {
commandCalls.push({ args, logPrefix, silent, opts });
return {
return createMockCommandResponse({
success: true,
output: 'Build succeeded',
error: undefined,
process: { pid: 12345 },
};
});
};

await buildDeviceLogic(
Expand Down Expand Up @@ -291,24 +295,24 @@ describe('build_device plugin', () => {
it('should include optional parameters in command', async () => {
const commandCalls: Array<{
args: string[];
logPrefix: string;
silent: boolean;
logPrefix?: string;
silent?: boolean;
opts: { cwd?: string } | undefined;
}> = [];

const stubExecutor = async (
args: string[],
logPrefix: string,
silent: boolean,
logPrefix?: string,
silent?: boolean,
opts?: { cwd?: string },
_detached?: boolean,
) => {
commandCalls.push({ args, logPrefix, silent, opts });
return {
return createMockCommandResponse({
success: true,
output: 'Build succeeded',
error: undefined,
process: { pid: 12345 },
};
});
};

await buildDeviceLogic(
Expand Down
Loading
Loading