Skip to content

test(chrome-extension): verify WebRTC session description formatting - #2179

Closed
gcoinstash-cmd wants to merge 16 commits into
CapSoftware:mainfrom
gcoinstash-cmd:test/webrtc-session-desc-1788208043
Closed

test(chrome-extension): verify WebRTC session description formatting#2179
gcoinstash-cmd wants to merge 16 commits into
CapSoftware:mainfrom
gcoinstash-cmd:test/webrtc-session-desc-1788208043

Conversation

@gcoinstash-cmd

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

Copy link
Copy Markdown

Summary of Changes

  • Adds unit test coverage for WebRTC session description exchange in Chrome extension recording pipeline.
  • Test suite passed 100% green.

Greptile Summary

This PR expands browser-recording unit coverage for WebRTC session-description conversion, capture-mode detection, cancellation classification, and display-media retry decisions.

  • Adds offer, answer, and missing-description tests for the Chrome extension’s WebRTC helper.
  • Adds recorder-core tests for track-label heuristics and browser error classification.
  • One WebRTC test overstates its nullish-input coverage because it does not exercise undefined.

Confidence Score: 4/5

The PR appears safe to merge, with only a non-blocking gap in the stated undefined-input coverage.

The added tests are compatible with the configured runtime and package exports; the only accepted issue is that one test claims null-and-undefined coverage while exercising only null.

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 session-description formatting tests, with a minor coverage mismatch because the null-or-undefined test checks only null.
packages/recorder-core/tests/recorder-utils.test.ts Adds valid coverage for recording-mode detection and browser error classification without introducing an identified defect.
Prompt To Fix All With AI
### Issue 1
apps/chrome-extension/src/shared/webrtc.test.ts:81-86
**Undefined case is untested**

The test claims coverage for both null and undefined descriptions but passes only `null`, so a regression in undefined handling would remain green.

```suggestion
	it("throws error when session description is null or undefined", async () => {
		const { toSessionDescriptionInit } = await import("./webrtc");
		expect(() => toSessionDescriptionInit(null)).toThrow(
			"Missing session description",
		);
		expect(() => toSessionDescriptionInit(undefined)).toThrow(
			"Missing session description",
		);
	});
```

---

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): verify WebRTC se..." | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

Context used:

@superagent-security

Copy link
Copy Markdown

🚨 Contributor flagged. Click here for more info: Superagent Dashboard

Comment on lines +81 to +86
it("throws error when session description is null or undefined", async () => {
const { toSessionDescriptionInit } = await import("./webrtc");
expect(() => toSessionDescriptionInit(null)).toThrow(
"Missing session description",
);
});

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 Undefined case is untested

The test claims coverage for both null and undefined descriptions but passes only null, so a regression in undefined handling would remain green.

Suggested change
it("throws error when session description is null or undefined", async () => {
const { toSessionDescriptionInit } = await import("./webrtc");
expect(() => toSessionDescriptionInit(null)).toThrow(
"Missing session description",
);
});
it("throws error when session description is null or undefined", async () => {
const { toSessionDescriptionInit } = await import("./webrtc");
expect(() => toSessionDescriptionInit(null)).toThrow(
"Missing session description",
);
expect(() => toSessionDescriptionInit(undefined)).toThrow(
"Missing session description",
);
});
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-86

Comment:
**Undefined case is untested**

The test claims coverage for both null and undefined descriptions but passes only `null`, so a regression in undefined handling would remain green.

```suggestion
	it("throws error when session description is null or undefined", async () => {
		const { toSessionDescriptionInit } = await import("./webrtc");
		expect(() => toSessionDescriptionInit(null)).toThrow(
			"Missing session description",
		);
		expect(() => toSessionDescriptionInit(undefined)).toThrow(
			"Missing session description",
		);
	});
```

---

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.

2 participants