Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions apps/chrome-extension/src/shared/webrtc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,26 @@ describe("waitForIceGatheringComplete", () => {
);
});
});

describe("toSessionDescriptionInit", () => {
it("formats valid RTCSessionDescription to RTCSessionDescriptionInit", async () => {
const { toSessionDescriptionInit } = await import("./webrtc");
const desc = {
type: "offer" as RTCSdpType,
sdp: "v=0\r\no=- 123456 2 IN IP4 127.0.0.1\r\n",
toJSON: () => ({}),
};
expect(toSessionDescriptionInit(desc as RTCSessionDescription)).toEqual({
type: "offer",
sdp: "v=0\r\no=- 123456 2 IN IP4 127.0.0.1\r\n",
});
});

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 name overstates coverage

This test names both null and undefined, but its only assertion passes null, so the suite reports explicit undefined coverage that it does not provide.

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 name overstates coverage**

This test names both `null` and `undefined`, but its only assertion passes `null`, so the suite reports explicit `undefined` coverage that it does not provide.

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

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

const { toSessionDescriptionInit } = await import("./webrtc");
expect(() => toSessionDescriptionInit(null)).toThrow(
"Missing session description",
);
});
});