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

676 B
Raw Blame
import { stripYamlTrailingComment } from './yaml';

describe('stripYamlTrailingComment', () => {
  it('strips comments separated from an unquoted scalar by whitespace', () => {
    expect(stripYamlTrailingComment('true   # enabled by default')).toBe('true');
    expect(stripYamlTrailingComment('false\t# disabled')).toBe('false');
    expect(stripYamlTrailingComment('hashtag#value')).toBe('hashtag#value');
    expect(stripYamlTrailingComment('  # comment only')).toBe('');
  });

  it('handles long comment-free whitespace runs in linear time', () => {
    const value = `a${' '.repeat(100_000)}b`;
    expect(stripYamlTrailingComment(value)).toBe(value);
  }, 1_000);
});