Skip to main content
Glama

Joke MCP Server

by ericqian77
validation.test.js1.18 kB
import { describe, it, expect } from 'vitest'; import { validateGetJokeInput, sanitizeBlacklist } from '../../src/validation.js'; const defaults = { defaultCategory: 'programming', lang: 'en' }; describe('validateGetJokeInput', () => { it('returns defaults when input is undefined', () => { const result = validateGetJokeInput(undefined, defaults); expect(result).toEqual({ category: 'programming', lang: 'en', blacklist: [] }); }); it('normalizes category and lang to lowercase', () => { const result = validateGetJokeInput({ category: 'Programming', lang: 'EN' }, defaults); expect(result).toEqual({ category: 'programming', lang: 'en', blacklist: [] }); }); it('throws on unsupported category', () => { expect(() => validateGetJokeInput({ category: 'space' }, defaults)).toThrow('Unsupported category'); }); it('throws on unsupported language', () => { expect(() => validateGetJokeInput({ lang: 'jp' }, defaults)).toThrow('Unsupported language'); }); it('sanitizes blacklist array', () => { const result = sanitizeBlacklist(['NSFW', 'religious', 'unknown', 'nsfw']); expect(result).toEqual(['nsfw', 'religious']); }); });

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/ericqian77/joke-mcp'

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