Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

test(tts): cover splitLongSpeechText / splitLongSpeechActions#694

Open
ly-wang19 wants to merge 1 commit into
THU-MAIC:main from
ly-wang19:test/tts-utils-coverage
Open

test(tts): cover splitLongSpeechText / splitLongSpeechActions #694
ly-wang19 wants to merge 1 commit into
THU-MAIC:main from
ly-wang19:test/tts-utils-coverage

Conversation

@ly-wang19

@ly-wang19 ly-wang19 commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

What & why

lib/audio/tts-utils.ts (TTS text/action splitting on the generation + playback paths) had no test coverage. The sentence → clause → hard-split chunking with a per-provider length cap is edge-case-prone and worth a regression lock.

Closes #693.

Coverage added (tests/audio/tts-utils.test.ts, 9 cases)

  • splitLongSpeechText: within-limit passthrough (trimmed), sentence-boundary split (punctuation kept), packing consecutive short sentences up to the limit, clause-punctuation fallback for over-long sentences, hard-splitting a punctuation-free run, and the invariant that no chunk exceeds maxLength (and none is empty) across several limits.
  • splitLongSpeechActions: provider with no limit → actions returned untouched (same ref); short speech + non-speech → untouched; over-limit speech → chunked sub-actions with <id>_tts_<n> ids, the parent audioId dropped, each chunk ≤ limit, and the text preserved across the split.

Note

No source change — coverage only. I verified the maxLength invariant holds against adversarial inputs (long no-punctuation runs, clause-heavy text, boundary lengths) before locking it in tests, so this documents correct behavior rather than fixing a bug. tsc/prettier/eslint clean.

lib/audio/tts-utils.ts had no tests. Add coverage for the sentence ->
clause -> hard-split chunking, the invariant that no chunk exceeds
maxLength (nor is empty), and the splitLongSpeechActions contract
(no-limit provider untouched; short/non-speech untouched; over-limit
split into <id>_tts_<n> sub-actions with the parent audioId dropped and
text preserved). Behavior verified against adversarial inputs first — no
source change, coverage only.
Closes THU-MAIC#693 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Add test coverage for the TTS text-splitting utilities (tts-utils.ts)

1 participant

AltStyle によって変換されたページ (->オリジナル) /