Skip to main content
Glama
ascii-art.test.tsโ€ข1.33 kB
import { describe, it, expect } from '@jest/globals'; import { formatDuckResponse, getRandomDuckMessage, duckMessages } from '../src/utils/ascii-art'; describe('formatDuckResponse', () => { it('should format response without model', () => { const result = formatDuckResponse('GPT Duck', 'Hello world'); expect(result).toBe('๐Ÿฆ† [GPT Duck]: Hello world'); }); it('should format response with model', () => { const result = formatDuckResponse('GPT Duck', 'Hello world', 'gpt-4o-mini'); expect(result).toBe('๐Ÿฆ† [GPT Duck | gpt-4o-mini]: Hello world'); }); it('should handle undefined model', () => { const result = formatDuckResponse('GPT Duck', 'Hello world', undefined); expect(result).toBe('๐Ÿฆ† [GPT Duck]: Hello world'); }); }); describe('getRandomDuckMessage', () => { it('should return a message from startup messages', () => { const result = getRandomDuckMessage('startup'); expect(duckMessages.startup).toContain(result); }); it('should return a message from error messages', () => { const result = getRandomDuckMessage('error'); expect(duckMessages.error).toContain(result); }); it('should return a message from success messages', () => { const result = getRandomDuckMessage('success'); expect(duckMessages.success).toContain(result); }); });

Latest Blog Posts

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/nesquikm/mcp-rubber-duck'

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