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

922 B
Raw Blame
import { agentUpdateSchema } from './validation';

describe('agent workspace default', () => {
  it('retains a default and an explicit reset through update validation', () => {
    expect(agentUpdateSchema.parse({ code_workspace_id: 'primary' }).code_workspace_id).toBe(
      'primary',
    );
    expect(agentUpdateSchema.parse({ code_workspace_id: '' }).code_workspace_id).toBe('');
    expect(agentUpdateSchema.parse({}).code_workspace_id).toBeUndefined();
  });

  it('rejects malformed or non-string defaults', () => {
    expect(agentUpdateSchema.safeParse({ code_workspace_id: 'x'.repeat(129) }).success).toBe(false);
    expect(agentUpdateSchema.safeParse({ code_workspace_id: 'bad workspace' }).success).toBe(false);
    expect(agentUpdateSchema.safeParse({ code_workspace_id: '../escape' }).success).toBe(false);
    expect(agentUpdateSchema.safeParse({ code_workspace_id: {} }).success).toBe(false);
  });
});