Skip to main content
Glama

Dart MCP Server

by egyleader
info.test.ts1.78 kB
import { info } from '../../src/tools/info.js'; import { executeDartCommand } from '../../src/utils/dart-executor.js'; // Mock dependencies jest.mock('../../src/utils/dart-executor.js', () => ({ executeDartCommand: jest.fn() })); describe('info tool', () => { beforeEach(() => { // Reset mocks before each test jest.mocked(executeDartCommand).mockReset(); // Default mock implementation jest.mocked(executeDartCommand).mockResolvedValue({ stdout: 'success', stderr: '' }); }); it('should execute the info command with no arguments by default', async () => { await info({}); // Should execute command with no additional args expect(executeDartCommand).toHaveBeenCalledWith('info', []); }); it('should pass through additional options', async () => { const options = ['--verbose']; await info({ options }); // Should execute command with the options expect(executeDartCommand).toHaveBeenCalledWith('info', options); }); it('should return successful command results', async () => { const expectedOutput = 'Dart SDK version: 2.19.6 (stable)'; jest.mocked(executeDartCommand).mockResolvedValue({ stdout: expectedOutput, stderr: '' }); const result = await info({}); expect(result).toEqual({ content: [{ type: 'text', text: expectedOutput }], isError: false }); }); it('should return error command results', async () => { const expectedError = 'Error: Unable to obtain Dart SDK info'; jest.mocked(executeDartCommand).mockResolvedValue({ stdout: '', stderr: expectedError }); const result = await info({}); expect(result).toEqual({ content: [{ type: 'text', text: expectedError }], isError: true }); }); });

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/egyleader/dart-mcp'

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