Skip to main content
Glama

MCP Design System Extractor

validators.test.ts2.17 kB
import { describe, it, expect } from 'vitest'; import { validateListComponentsInput, validateGetComponentHTMLInput, validateSearchComponentsInput } from '../../../src/utils/validators.js'; describe('validators', () => { describe('validateListComponentsInput', () => { it('should validate valid input with all fields', () => { const input = { category: 'buttons', page: 1, pageSize: 10 }; const result = validateListComponentsInput(input); expect(result).toEqual({ category: 'buttons', page: 1, pageSize: 10 }); }); it('should validate input with only optional fields', () => { const input = {}; const result = validateListComponentsInput(input); expect(result).toEqual({}); }); it('should throw error for invalid page size', () => { const input = { pageSize: 0 }; expect(() => validateListComponentsInput(input)).toThrow(); }); }); describe('validateGetComponentHTMLInput', () => { it('should validate valid input', () => { const input = { componentId: 'button-primary', includeStyles: true }; const result = validateGetComponentHTMLInput(input); expect(result).toEqual({ componentId: 'button-primary', includeStyles: true }); }); it('should require componentId', () => { const input = {}; expect(() => validateGetComponentHTMLInput(input)).toThrow(); }); }); describe('validateSearchComponentsInput', () => { it('should validate valid search input', () => { const input = { query: 'button', searchIn: 'name' as const, page: 1, pageSize: 20 }; const result = validateSearchComponentsInput(input); expect(result).toEqual({ query: 'button', searchIn: 'name', page: 1, pageSize: 20 }); }); it('should require query', () => { const input = {}; expect(() => validateSearchComponentsInput(input)).toThrow(); }); }); });

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/freema/mcp-design-system-extractor'

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