Skip to content

Commit e893704

Browse files
author
Алексей
committed
test: add regression test for /model <name> setting path
Addresses review feedback from Greptile — ensures that real model names (e.g. /model gpt-4.1) still correctly call sessions.patch.
1 parent aa20da5 commit e893704

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

‎ui/src/ui/chat/slash-command-executor.node.test.ts‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,28 @@ describe("executeSlashCommand /model subcommands", () => {
323323
expect.objectContaining({ model: "info" }),
324324
);
325325
});
326+
327+
it("sets a real model name via sessions.patch (regression)", async () => {
328+
const request = vi.fn(async (method: string, _payload?: unknown) => {
329+
if (method === "sessions.patch") {
330+
return { ok: true };
331+
}
332+
throw new Error(`unexpected method: ${method}`);
333+
});
334+
335+
const result = await executeSlashCommand(
336+
{ request } as unknown as GatewayBrowserClient,
337+
"main",
338+
"model",
339+
"gpt-4.1",
340+
);
341+
342+
expect(result.content).toContain("gpt-4.1");
343+
expect(request).toHaveBeenCalledWith(
344+
"sessions.patch",
345+
expect.objectContaining({ model: "gpt-4.1" }),
346+
);
347+
});
326348
});
327349

328350
describe("executeSlashCommand directives", () => {

0 commit comments

Comments
 (0)