Skip to content

test(recorder-core): add test coverage for detectRecordingModeFromTrack - #2159

Open
gcoinstash-cmd wants to merge 3 commits into
CapSoftware:mainfrom
gcoinstash-cmd:test/recorder-detect-mode-track-tests
Open

test(recorder-core): add test coverage for detectRecordingModeFromTrack#2159
gcoinstash-cmd wants to merge 3 commits into
CapSoftware:mainfrom
gcoinstash-cmd:test/recorder-detect-mode-track-tests

Conversation

@gcoinstash-cmd

@gcoinstash-cmd gcoinstash-cmd commented Aug 28, 2026

Copy link
Copy Markdown

Summary of Changes

  • Adds test cases in packages/recorder-core/__tests__/recorder-utils.test.ts for detectRecordingModeFromTrack.
  • Verifies graceful handling of null input tracks and validates track label parsing heuristics across fullscreen, application window, and browser tab captures.

Test Validation

  • pnpm --filter=@cap/recorder-core test: 67/67 unit tests passed 100% green in 1.51s.
  • All recorder package tests pass cleanly.

Greptile Summary

This PR expands unit coverage for recording-mode detection and WebRTC session-description conversion.

  • Adds null and label-heuristic cases for fullscreen, window, and browser-tab recording detection.
  • Adds valid and missing WebRTC session-description cases.

Confidence Score: 4/5

The PR appears safe to merge, with only a non-blocking inaccurate test description.

The added tests do not change production behavior; the only accepted concern is that one test name overstates the invalid-input cases it exercises.

Files Needing Attention: apps/chrome-extension/src/shared/webrtc.test.ts

Important Files Changed

Filename Overview
apps/chrome-extension/src/shared/webrtc.test.ts Adds conversion and missing-description tests, but one test title claims undefined coverage that its assertion does not exercise.
packages/recorder-core/tests/recorder-utils.test.ts Adds focused coverage for null tracks and each label-based recording-mode heuristic without introducing a concrete defect.
Prompt To Fix All With AI
### Issue 1
apps/chrome-extension/src/shared/webrtc.test.ts:68
**Test title overstates coverage**

The test claims to cover both `null` and `undefined`, but its only invocation passes `null`; this makes the suite report an invalid-input case as covered when it is not exercised.

```suggestion
	it("throws error when session description is null", async () => {
```

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "test(recorder-core): add test coverage f..." | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

@superagent-security

Copy link
Copy Markdown

Manage your Superagent protection

Superagent has paused scans for this repository because this unlinked GitHub App installation has used all three included PR scans.

You have 0 of 3 included PR scans remaining.

Create a free account to continue protection, manage scan settings, review security history, and control which repositories are protected.

});
});

it("throws error when session description is null or undefined", async () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Test title overstates coverage

The test claims to cover both null and undefined, but its only invocation passes null; this makes the suite report an invalid-input case as covered when it is not exercised.

Suggested change
it("throws error when session description is null or undefined", async () => {
it("throws error when session description is null", async () => {
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/chrome-extension/src/shared/webrtc.test.ts
Line: 68

Comment:
**Test title overstates coverage**

The test claims to cover both `null` and `undefined`, but its only invocation passes `null`; this makes the suite report an invalid-input case as covered when it is not exercised.

```suggestion
	it("throws error when session description is null", async () => {
```

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

注册 for free to join this conversation on GitHub. Already have an account? 登录 to comment

标签

None yet

项目

None yet

Development

Successfully merging this pull request may close these issues.

1 participant