Skip to main content
Glama

MCP Xcode

by Stefan-Nitu
InstallRequest.unit.test.ts2.85 kB
import { describe, it, expect } from '@jest/globals'; import { InstallRequest } from '../../domain/InstallRequest.js'; describe('InstallRequest', () => { describe('create', () => { it('should create valid install request with simulator ID', () => { // Arrange & Act const request = InstallRequest.create( '/path/to/app.app', 'iPhone-15-Simulator' ); // Assert expect(request.appPath.toString()).toBe('/path/to/app.app'); expect(request.simulatorId?.toString()).toBe('iPhone-15-Simulator'); }); it('should create valid install request without simulator ID', () => { // Arrange & Act const request = InstallRequest.create( '/path/to/app.app' ); // Assert expect(request.appPath.toString()).toBe('/path/to/app.app'); expect(request.simulatorId).toBeUndefined(); }); it('should reject empty app path', () => { // Arrange & Act & Assert expect(() => InstallRequest.create('', 'test-sim')) .toThrow('App path cannot be empty'); }); it('should reject whitespace-only app path', () => { // Arrange & Act & Assert expect(() => InstallRequest.create(' ', 'test-sim')) .toThrow('App path cannot be empty'); }); it('should reject invalid app extension', () => { // Arrange & Act & Assert expect(() => InstallRequest.create('/path/to/file.txt', 'test-sim')) .toThrow('App path must end with .app'); }); it('should accept .app bundle path', () => { // Arrange & Act const request = InstallRequest.create( '/path/to/MyApp.app', 'test-sim' ); // Assert expect(request.appPath.toString()).toBe('/path/to/MyApp.app'); }); it('should trim whitespace from simulator ID', () => { // Arrange & Act const request = InstallRequest.create( '/path/to/app.app', ' test-sim ' ); // Assert expect(request.simulatorId?.toString()).toBe('test-sim'); }); }); describe('validation', () => { it('should reject path traversal attempts', () => { // Arrange & Act & Assert expect(() => InstallRequest.create('../../../etc/passwd.app')) .toThrow(); }); it('should accept absolute paths', () => { // Arrange & Act const request = InstallRequest.create( '/Users/developer/MyApp.app' ); // Assert expect(request.appPath.toString()).toBe('/Users/developer/MyApp.app'); }); it('should accept relative paths within project', () => { // Arrange & Act const request = InstallRequest.create( './build/Debug/MyApp.app' ); // Assert expect(request.appPath.toString()).toBe('./build/Debug/MyApp.app'); }); }); });

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Stefan-Nitu/mcp-xcode'

If you have feedback or need assistance with the MCP directory API, please join our Discord server