Spaces:
Running
Running
Download src/lib/commands.test.ts from evalstate/mcp-webcam: direct link, hf CLI and curl.
- Browser
- Download file 1.37 kB
-
https://huggingface.co/spaces/evalstate/mcp-webcam/resolve/main/src/lib/commands.test.ts
- Command line
-
hf download hf://spaces/evalstate/mcp-webcam/src/lib/commands.test.ts
-
curl -L -o commands.test.ts https://huggingface.co/spaces/evalstate/mcp-webcam/resolve/main/src/lib/commands.test.ts
1.37 kB
| import { describe, expect, it } from 'vitest'; | |
| import { buildConnectSnippets, buildMcpUrl } from './commands'; | |
| describe('connect command snippets', () => { | |
| it('builds MCP URL with optional ?user=', () => { | |
| expect(buildMcpUrl({ mcpHost: 'http://localhost:3334/', mcpPath: '/mcp', user: 'default' })).toBe( | |
| 'http://localhost:3334/mcp', | |
| ); | |
| expect(buildMcpUrl({ mcpHost: 'https://cam.example.com', mcpPath: '/mcp', user: 'room-42' })).toBe( | |
| 'https://cam.example.com/mcp?user=room-42', | |
| ); | |
| }); | |
| it('builds all expected snippets embedding the MCP URL', () => { | |
| const url = 'http://localhost:3334/mcp?user=demo'; | |
| const snippets = buildConnectSnippets(url); | |
| const ids = snippets.map((s) => s.id); | |
| expect(ids).toEqual(['uvx', 'mcp-connect', 'config-yaml', 'claude-code', 'claude-desktop', 'vscode', 'curl']); | |
| const uvx = snippets.find((s) => s.id === 'uvx')!; | |
| expect(uvx.code).toContain(`--url ${url}`); | |
| const yaml = snippets.find((s) => s.id === 'config-yaml')!; | |
| expect(yaml.code).toContain('protocol_mode: modern'); | |
| expect(yaml.code).toContain('webcam.message'); | |
| expect(yaml.code).toContain(`url: ${url}`); | |
| const curl = snippets.find((s) => s.id === 'curl')!; | |
| expect(curl.code).toContain('MCP-Protocol-Version: 2026-07-28'); | |
| expect(curl.code).toContain('server/discover'); | |
| }); | |
| }); | |