Skip to content
Closed
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
21 changes: 21 additions & 0 deletions nodejs/test/extension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
process.env.SESSION_ID = "session-123";
const resumeForExtension = vi
.spyOn(CopilotClient.prototype, "resumeSessionForExtension")
.mockResolvedValue({} as any);

Check warning on line 23 in nodejs/test/extension.test.ts

View workflow job for this annotation

GitHub Actions / nodejs / Node.js SDK Tests (macos-latest, inprocess)

Unexpected any. Specify a different type

Check warning on line 23 in nodejs/test/extension.test.ts

View workflow job for this annotation

GitHub Actions / nodejs / Node.js SDK Tests (windows-latest, default)

Unexpected any. Specify a different type

Check warning on line 23 in nodejs/test/extension.test.ts

View workflow job for this annotation

GitHub Actions / nodejs / Node.js SDK Tests (windows-latest, inprocess)

Unexpected any. Specify a different type

Check warning on line 23 in nodejs/test/extension.test.ts

View workflow job for this annotation

GitHub Actions / nodejs / Node.js SDK Tests (macos-latest, default)

Unexpected any. Specify a different type

Check warning on line 23 in nodejs/test/extension.test.ts

View workflow job for this annotation

GitHub Actions / nodejs / Node.js SDK Tests (ubuntu-latest, inprocess)

Unexpected any. Specify a different type

Check warning on line 23 in nodejs/test/extension.test.ts

View workflow job for this annotation

GitHub Actions / nodejs / Node.js SDK Tests (ubuntu-latest, default)

Unexpected any. Specify a different type

await joinSession({ tools: [] });

Expand All @@ -38,7 +38,7 @@
process.env.SESSION_ID = "session-123";
const resumeForExtension = vi
.spyOn(CopilotClient.prototype, "resumeSessionForExtension")
.mockResolvedValue({} as any);

Check warning on line 41 in nodejs/test/extension.test.ts

View workflow job for this annotation

GitHub Actions / nodejs / Node.js SDK Tests (macos-latest, inprocess)

Unexpected any. Specify a different type

Check warning on line 41 in nodejs/test/extension.test.ts

View workflow job for this annotation

GitHub Actions / nodejs / Node.js SDK Tests (windows-latest, default)

Unexpected any. Specify a different type

Check warning on line 41 in nodejs/test/extension.test.ts

View workflow job for this annotation

GitHub Actions / nodejs / Node.js SDK Tests (windows-latest, inprocess)

Unexpected any. Specify a different type

Check warning on line 41 in nodejs/test/extension.test.ts

View workflow job for this annotation

GitHub Actions / nodejs / Node.js SDK Tests (macos-latest, default)

Unexpected any. Specify a different type

Check warning on line 41 in nodejs/test/extension.test.ts

View workflow job for this annotation

GitHub Actions / nodejs / Node.js SDK Tests (ubuntu-latest, inprocess)

Unexpected any. Specify a different type

Check warning on line 41 in nodejs/test/extension.test.ts

View workflow job for this annotation

GitHub Actions / nodejs / Node.js SDK Tests (ubuntu-latest, default)

Unexpected any. Specify a different type

await joinSession({ onPermissionRequest: approveAll, suppressResumeEvent: false });

Expand All @@ -57,4 +57,25 @@

expect(canvas.declaration.id).toBe("counter");
});

it("forwards canvas providers when joining as an extension", async () => {
process.env.SESSION_ID = "session-123";
const resumeForExtension = vi
.spyOn(CopilotClient.prototype, "resumeSessionForExtension")
.mockResolvedValue({} as any);

Check warning on line 65 in nodejs/test/extension.test.ts

View workflow job for this annotation

GitHub Actions / nodejs / Node.js SDK Tests (macos-latest, inprocess)

Unexpected any. Specify a different type

Check warning on line 65 in nodejs/test/extension.test.ts

View workflow job for this annotation

GitHub Actions / nodejs / Node.js SDK Tests (windows-latest, default)

Unexpected any. Specify a different type

Check warning on line 65 in nodejs/test/extension.test.ts

View workflow job for this annotation

GitHub Actions / nodejs / Node.js SDK Tests (windows-latest, inprocess)

Unexpected any. Specify a different type

Check warning on line 65 in nodejs/test/extension.test.ts

View workflow job for this annotation

GitHub Actions / nodejs / Node.js SDK Tests (macos-latest, default)

Unexpected any. Specify a different type

Check warning on line 65 in nodejs/test/extension.test.ts

View workflow job for this annotation

GitHub Actions / nodejs / Node.js SDK Tests (ubuntu-latest, inprocess)

Unexpected any. Specify a different type

Check warning on line 65 in nodejs/test/extension.test.ts

View workflow job for this annotation

GitHub Actions / nodejs / Node.js SDK Tests (ubuntu-latest, default)

Unexpected any. Specify a different type
const canvas = createCanvas({
id: "counter",
displayName: "Counter",
description: "A counter canvas",
open: () => ({ url: "https://example.test/counter" }),
});

await joinSession({ canvases: [canvas] });

expect(resumeForExtension).toHaveBeenCalledWith(
"session-123",
expect.objectContaining({ canvases: [canvas] }),
undefined
);
});
});
Loading