Add unit tests for subtitle timing functions in subtitle-renderer.ts
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 95/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
Research direction
Start by reading frontend/src/engine/subtitle-renderer.ts and the three specified functions, then follow the test setup in CONTRIBUTING.md. Create frontend/src/engine/subtitle-renderer.test.ts with the listed timing, fallback, skip, window, and boundary cases. Run npx vitest run src/engine/subtitle-renderer.test.ts; the test should pass without changes to production code.
Written by the indexing model from the issue text.
Description
Context
Every MP4 the app exports burns captions in using these three pure functions, and none of them is tested. wordTimingsFromChunks is what lines captions up with real Whisper timestamps on the audio-to-video flow (one of the flows the ROADMAP lists as proven), so a regression here silently desyncs captions.
Where
frontend/src/engine/subtitle-renderer.ts:128-158:wordTimingsFromChunks(chunks, fallbackWordDuration):161-180:generateWordTimings(text, start, duration):183-208:getCurrentSubtitleText(timings, t, windowSize)- The file has no imports, so it can be tested directly
What to do
Create src/engine/subtitle-renderer.test.ts covering:
generateWordTimings: empty or whitespace text →[]; words split evenly; the lastendTime === start + duration.wordTimingsFromChunks: normal chunks; a chunk with anull/NaNend falls back towords * fallbackWordDuration; a missing start continues from the previous chunk's end; empty-text chunks are skipped.getCurrentSubtitleText: before the first word →{text:'', activeWordIndex:-1}; a mid-stream window is centred; near the end the window is truncated (record the current behaviour; open a follow-up issue if you think it should backfill).- Boundary:
currentTime === endTimebelongs to the next word.
Acceptance criteria
-
npx vitest run src/engine/subtitle-renderer.test.tspasses - No production code changed, or any change is a separate commit with a test that justifies it
- Paste the test output in the PR
Getting started
Read CONTRIBUTING.md for dev setup and the quality bar (no facades, evidence before done). Comment here to claim the issue.
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 3
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 5
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from BeyondITL/contentine-create
-
good first issue level: 1 ui
Difficulty 2/5 1-3 hours Newbie friendliness 94/100
BeyondITL/contentine-create#58 ·
Maintainers usually reply within 1 day
-
Fix Enter on the marketplace Buy button opening details instead of buyingPossibly taken @developedbyBob claimed this 5 days ago. Openaccessibility claimed good first issue level: 1
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
BeyondITL/contentine-create#57 · 3 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
Enable JSX in vitest so React component tests can runPossibly taken @29miaoet claimed this 5 days ago. Openclaimed good first issue level: 1 testing
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
BeyondITL/contentine-create#56 · 2 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
good first issue level: 1 testing
Difficulty 2/5 1-3 hours Newbie friendliness 94/100
BeyondITL/contentine-create#55 ·
Maintainers usually reply within 1 day
-
good first issue level: 1 testing
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
BeyondITL/contentine-create#54 ·
Maintainers usually reply within 1 day
All issues in BeyondITL/contentine-create
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
"Claude Code request is missing its initial user message" when the prompt starts with an image pathOpen
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
earendil-works/pi-claude-code#31 ·
Maintainers usually reply within 8 days
-
bug pending triage
Difficulty 1/5 Under an hour Newbie friendliness 92/100
privatenumber/cleye#48 ·
-
Google text documents are base64-encoded twicePossibly taken @feiiiiii5 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day