Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

1017 B
Raw Blame
import { isHtmlMediaType, isMcpAppMimeType, resolveMCPUIResourceMimeType } from './appMime';

describe('MCP UI media types', () => {
  it.each([
    [undefined, 'text/html'],
    [null, 'text/html'],
    ['', ''],
    ['application/xhtml+xml', 'application/xhtml+xml'],
  ])('normalizes %j to %j', (mimeType, expected) => {
    expect(resolveMCPUIResourceMimeType(mimeType)).toBe(expected);
  });

  it.each([
    ['text/html', true],
    ['Text/HTML', true],
    [' text/html ; charset=utf-8', true],
    ['application/xhtml+xml', false],
    ['', false],
    [undefined, false],
  ])('classifies legacy MIME %j as HTML=%s', (mimeType, expected) => {
    expect(isHtmlMediaType(mimeType)).toBe(expected);
  });

  it('keeps the App profile strict to text/html', () => {
    expect(isMcpAppMimeType('text/html;profile=mcp-app')).toBe(true);
    expect(isMcpAppMimeType('application/xhtml+xml;profile=mcp-app')).toBe(false);
    expect(isMcpAppMimeType(resolveMCPUIResourceMimeType(undefined))).toBe(false);
  });
});