Skip to content

test(chrome-extension): add unit test for answer session description init formatting - #2165

Open
gcoinstash-cmd wants to merge 5 commits into
CapSoftware:mainfrom
gcoinstash-cmd:test/chrome-extension-webrtc-answer-init
Open

test(chrome-extension): add unit test for answer session description init formatting#2165
gcoinstash-cmd wants to merge 5 commits into
CapSoftware:mainfrom
gcoinstash-cmd:test/chrome-extension-webrtc-answer-init

Conversation

@gcoinstash-cmd

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

Copy link
Copy Markdown

Summary of Changes

  • Adds test coverage for answer type RTCSessionDescription formatting in toSessionDescriptionInit.
  • Verifies that answer SDP descriptions correctly format into RTCSessionDescriptionInit objects for camera-preview peers.

Test Validation

  • pnpm biome check apps/chrome-extension: 0 lint errors across 74 files.
  • pnpm --filter=@cap/chrome-extension test: 21/21 tests passed 100% green in 849ms.

Greptile Summary

This PR adds unit coverage for WebRTC session-description formatting and several shared recorder utility behaviors.

  • Verifies offer and answer conversion into RTCSessionDescriptionInit.
  • Exercises recording-mode label heuristics and capture-error classification.
  • Adds invalid-input coverage for a null WebRTC session description.

Confidence Score: 4/5

The PR appears safe to merge, with only a non-blocking mismatch between one test name and the input it exercises.

The added assertions align with the current implementations and supported test runtime; the sole concern is misleadingly stated undefined-input coverage.

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 accurate offer/answer formatting assertions, but one test title claims undefined coverage that its body does not provide.
packages/recorder-core/tests/recorder-utils.test.ts Adds consistent tests for label-based recording-mode detection and browser capture error classification without introducing a concrete defect.
Prompt To Fix All With AI
### Issue 1
apps/chrome-extension/src/shared/webrtc.test.ts:81
**Test overstates invalid-input coverage**

The test description names both `null` and `undefined`, but its only assertion passes `null`. This reports coverage for an undefined-input case that the test never executes, making future coverage assessments misleading.

```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(chrome-extension): add unit test fo..." | 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 overstates invalid-input coverage

The test description names both null and undefined, but its only assertion passes null. This reports coverage for an undefined-input case that the test never executes, making future coverage assessments misleading.

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: 81

Comment:
**Test overstates invalid-input coverage**

The test description names both `null` and `undefined`, but its only assertion passes `null`. This reports coverage for an undefined-input case that the test never executes, making future coverage assessments misleading.

```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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant