Skip to main content
Glama

Joke MCP Server

by ericqian77
local-provider.test.js949 B
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'; import { getJoke } from '../../src/providers/local.js'; const mockRandom = (value) => { vi.spyOn(Math, 'random').mockReturnValue(value); }; describe('local provider', () => { afterEach(() => { vi.restoreAllMocks(); }); it('returns a programming joke when available', async () => { mockRandom(0); const joke = await getJoke({ category: 'programming', lang: 'en', blacklist: [] }); expect(joke.source).toBe('local-fallback'); expect(joke.category).toBe('programming'); expect(typeof joke.text).toBe('string'); }); it('falls back to same language when category missing', async () => { mockRandom(0); const joke = await getJoke({ category: 'spooky', lang: 'zh', blacklist: [] }); expect(joke.source).toBe('local-fallback'); expect(joke.category).toBe('programming'); expect(joke.text).toContain('程序员'); }); });

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