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

1016 B
Raw Blame
import { normalizeArtifactDeliveryFailure } from './artifactDelivery';

describe('normalizeArtifactDeliveryFailure', () => {
  it('retains only the bounded public contract', () => {
    expect(
      normalizeArtifactDeliveryFailure({
        code: 'artifact_delivery_failed',
        status: 'partial',
        attempted: 3,
        delivered: 2,
        failed: 1,
        detail: 'private storage failure',
      }),
    ).toEqual({
      code: 'artifact_delivery_failed',
      status: 'partial',
      attempted: 3,
      delivered: 2,
      failed: 1,
    });
  });

  it.each([
    null,
    { code: 'storage_error', status: 'failed', attempted: 1, delivered: 0, failed: 1 },
    { code: 'artifact_delivery_failed', status: 'failed', attempted: 2, delivered: 1, failed: 1 },
    { code: 'artifact_delivery_failed', status: 'partial', attempted: 1, delivered: 0, failed: 1 },
  ])('rejects malformed external values', (value) => {
    expect(normalizeArtifactDeliveryFailure(value)).toBeUndefined();
  });
});