Skip to content
Draft
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
28 changes: 27 additions & 1 deletion nodejs/test/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
type GitHubTelemetryNotification,
type ModelInfo,
} from "../src/index.js";
import type { Model } from "../src/generated/rpc.js";
import { CopilotSession } from "../src/session.js";
import { defaultJoinSessionPermissionHandler } from "../src/types.js";

Expand Down Expand Up @@ -2854,7 +2855,32 @@ describe("CopilotClient", () => {
});
});

describe("onListModels", () => {
describe("model listing", () => {
it("preserves synthetic model identifiers and picker metadata through models.list", async () => {
const models: Model[] = [
{
id: "hydrafusion",
name: "HydraFusion",
capabilities: {},
modelPickerCategory: "powerful",
},
{
id: "hydrafusion-max",
name: "HydraFusion Max",
capabilities: {},
modelPickerCategory: "powerful",
},
];
const sendRequest = vi.fn().mockResolvedValue({ models });
const client = new CopilotClient();
(client as any).connection = { sendRequest };

const result = await client.rpc.models.list({});

expect(sendRequest).toHaveBeenCalledWith("models.list", {});
expect(result.models).toEqual(models);
});

it("calls onListModels handler instead of RPC when provided", async () => {
const customModels: ModelInfo[] = [
{
Expand Down
Loading