Skip to content

Commit 67f75e0

Browse files
andysalernoCopilot
andcommitted
Node: Cover synthetic model list compatibility
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 521aa26 commit 67f75e0

1 file changed

Lines changed: 27 additions & 1 deletion

File tree

nodejs/test/client.test.ts

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
type Managed设置,
1717
type ModelInfo,
1818
} from "../src/index.js";
19+
import type { Model } from "../src/generated/rpc.js";
1920
import { CopilotSession } from "../src/session.js";
2021
import { defaultJoinSessionPermissionHandler } from "../src/types.js";
2122

@@ -2984,7 +2985,32 @@ describe("CopilotClient", () => {
29842985
});
29852986
});
29862987

2987-
describe("onListModels", () => {
2988+
describe("model listing", () => {
2989+
it("preserves synthetic model identifiers and picker metadata through models.list", async () => {
2990+
const models: Model[] = [
2991+
{
2992+
id: "hydrafusion",
2993+
name: "HydraFusion",
2994+
capabilities: {},
2995+
modelPickerCategory: "powerful",
2996+
},
2997+
{
2998+
id: "hydrafusion-max",
2999+
name: "HydraFusion Max",
3000+
capabilities: {},
3001+
modelPickerCategory: "powerful",
3002+
},
3003+
];
3004+
const sendRequest = vi.fn().mockResolvedValue({ models });
3005+
const client = new CopilotClient();
3006+
(client as any).connection = { sendRequest };
3007+
3008+
const result = await client.rpc.models.list({});
3009+
3010+
expect(sendRequest).toHaveBeenCalledWith("models.list", {});
3011+
expect(result.models).toEqual(models);
3012+
});
3013+
29883014
it("calls onListModels handler instead of RPC when provided", async () => {
29893015
const customModels: ModelInfo[] = [
29903016
{

0 commit comments

Comments
 (0)