feat: add comprehensive test coverage for 7 modules (150 tests)#798
Conversation
New test files (150 tests, 0 failures): - subtitles/srt: 22 tests (timestamps, multi-line, malformed, line endings) - subtitles/ass: 17 tests (styles, alignment, override tags, resolution) - subtitles/parse: 8 tests (dispatch, case-insensitive, unsupported ext) - utils/math-extended: 35 tests (clamp, snapToStep, isNearlyEqual, format) - fps-extended: 16 tests (frameRate conversion, NTSC, GCD reduction) - rendering: 15 tests (transform builder, opacity, blend modes) - params: 32 tests (coerce, valueKind, interpolation, numeric range) Also includes HANDOFF.md with full documentation of workflow, completed work, and next steps for other agents.
|
Someone is attempting to deploy a commit to the OpenCut OSS Team on Vercel. A member of the Team first needs to authorize it. |
📝 WalkthroughWalkthroughThis pull request adds comprehensive unit test coverage for seven previously untested modules in ChangesUnit Test Coverage for Core Utilities and Parsers
🎯 2 (Simple) | ⏱️ ~12 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
apps/web/src/fps/__tests__/fps-extended.test.ts (1)
96-99: ⚡ Quick winFix the GCD-reduction test to use a true fractional input.
This case currently uses
25, so it only re-validates integer mapping and does not exercise fraction reduction logic as the test name states.Suggested test adjustment
- test("reduces arbitrary fractional fps with GCD", () => { - const result = floatToFrameRate(25); - expect(result).toEqual({ numerator: 25, denominator: 1 }); - }); + test("reduces arbitrary fractional fps with GCD", () => { + const result = floatToFrameRate(12.5); + expect(result).toEqual({ numerator: 25, denominator: 2 }); + });🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/web/src/fps/__tests__/fps-extended.test.ts` around lines 96 - 99, The test named "reduces arbitrary fractional fps with GCD" is using an integer (25) so it doesn't exercise fraction reduction; update the test to pass a true fractional input (e.g., call floatToFrameRate with 25.5) and assert the reduced fraction (for 25.5 expect { numerator: 51, denominator: 2 }) so floatToFrameRate's GCD reduction logic is actually validated.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@HANDOFF.md`:
- Around line 99-107: Update the fenced code block under the "Files Created"
section to include a language identifier so markdownlint MD040 is satisfied;
replace the opening fence ``` with ```text (i.e., change the triple backticks
before the file list to ```text) and keep the closing ``` unchanged to mark it
as a text block.
---
Nitpick comments:
In `@apps/web/src/fps/__tests__/fps-extended.test.ts`:
- Around line 96-99: The test named "reduces arbitrary fractional fps with GCD"
is using an integer (25) so it doesn't exercise fraction reduction; update the
test to pass a true fractional input (e.g., call floatToFrameRate with 25.5) and
assert the reduced fraction (for 25.5 expect { numerator: 51, denominator: 2 })
so floatToFrameRate's GCD reduction logic is actually validated.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 8bc22a60-f703-45eb-8703-2ea23b8741ec
📒 Files selected for processing (8)
HANDOFF.mdapps/web/src/fps/__tests__/fps-extended.test.tsapps/web/src/params/__tests__/params.test.tsapps/web/src/rendering/__tests__/rendering.test.tsapps/web/src/subtitles/__tests__/ass.test.tsapps/web/src/subtitles/__tests__/parse.test.tsapps/web/src/subtitles/__tests__/srt.test.tsapps/web/src/utils/__tests__/math-extended.test.ts
| ``` | ||
| apps/web/src/subtitles/__tests__/srt.test.ts | ||
| apps/web/src/subtitles/__tests__/ass.test.ts | ||
| apps/web/src/subtitles/__tests__/parse.test.ts | ||
| apps/web/src/utils/__tests__/math-extended.test.ts | ||
| apps/web/src/fps/__tests__/fps-extended.test.ts | ||
| apps/web/src/rendering/__tests__/rendering.test.ts | ||
| apps/web/src/params/__tests__/params.test.ts | ||
| ``` |
There was a problem hiding this comment.
Add a language identifier to the fenced code block.
The block under “Files Created” is missing a fence language, which triggers markdownlint MD040.
Suggested fix
-```
+```text
apps/web/src/subtitles/__tests__/srt.test.ts
apps/web/src/subtitles/__tests__/ass.test.ts
apps/web/src/subtitles/__tests__/parse.test.ts
apps/web/src/utils/__tests__/math-extended.test.ts
apps/web/src/fps/__tests__/fps-extended.test.ts
apps/web/src/rendering/__tests__/rendering.test.ts
apps/web/src/params/__tests__/params.test.ts</details>
<details>
<summary>🧰 Tools</summary>
<details>
<summary>🪛 markdownlint-cli2 (0.22.1)</summary>
[warning] 99-99: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
</details>
</details>
<details>
<summary>🤖 Prompt for AI Agents</summary>
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @HANDOFF.md around lines 99 - 107, Update the fenced code block under the
"Files Created" section to include a language identifier so markdownlint MD040
is satisfied; replace the opening fence withtext (i.e., change the
triple backticks before the file list to text) and keep the closing
unchanged to mark it as a text block.
</details>
<!-- fingerprinting:phantom:poseidon:hawk -->
<!-- This is an auto-generated comment by CodeRabbit -->
Summary
Adds 150 passing tests across 7 modules that previously lacked test coverage.
New Test Files
subtitles/__tests__/srt.test.tssubtitles/__tests__/ass.test.tssubtitles/__tests__/parse.test.tsutils/__tests__/math-extended.test.tsfps/__tests__/fps-extended.test.tsrendering/__tests__/rendering.test.tsparams/__tests__/params.test.tsAlso includes
HANDOFF.mdwith full documentation of workflow, completed work, and next stepsAll tests pass:
bun test→ 150 pass, 0 fail, 292 expect() calls, 60msSummary by CodeRabbit