Skip to content

Add unit tests for ai/text.js truncation helper #7

Description

@false200

What is this about?

Problem

trimTextForApi() caps OCR text at 14,000 chars before sending to AI providers. No tests verify this behavior.

Where to look

  • ai/text.jstrimTextForApi, MAX_API_TEXT_CHARS
  • New file: scripts/test-text.mjs
  • Wire into npm test (see related markdown test issue)

Acceptance criteria

  • Short text returned unchanged
  • Text over 14,000 chars truncated with [truncated to save tokens]
  • Edge cases: empty string, exactly 14,000 chars

Skills needed

Basic Node assertions — pair nicely with the markdown test issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions