Files
openidea/src/features/settings/__tests__/agents.test.ts
T
Deng Liuanddengliu 8432bf9997 feat(agents): add "Fit conversation to the window width" chat setting (#3455)
Settings › Agents › Chat › Conversation gets an opt-in toggle (agents.fitWindowWidth, off by default). When on, the conversation stream, composer, question card, user message bubbles and the New Task page drop their max-width caps and follow the pane width; when off, the readable 900 px column stays.

Co-authored-by: dengliu <5108773+dengliu@users.noreply.github.com>
2026-11-15 09:50:13 +08:00

56 lines
1.7 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { validateSettings } from "../model/schema";
describe("agent chat settings", () => {
it("defaults every meter but the cost to on and keeps stored values", () => {
expect(validateSettings({}).agents).toEqual({
showContextUsage: true,
showWorkTime: true,
showUsageLimits: true,
showCost: false,
foldTurns: true,
smoothText: true,
fitWindowWidth: false,
thinking: "auto",
toolCalls: "grouped",
expandToolOutput: false,
sendWith: "enter",
whileRunning: "queue",
newTaskApprovals: "bypass",
defaults: {},
mcpServers: {},
});
const stored = validateSettings({
agents: { showUsageLimits: false, showCost: true, showWorkTime: "no", fitWindowWidth: true },
}).agents;
expect(stored).toMatchObject({
showContextUsage: true,
showWorkTime: true,
showUsageLimits: false,
showCost: true,
fitWindowWidth: true,
});
expect(validateSettings({ agents: { fitWindowWidth: "yes" } }).agents.fitWindowWidth).toBe(false);
});
it("keeps valid chat choices and per-agent defaults", () => {
const stored = validateSettings({
agents: {
thinking: "collapsed",
toolCalls: "nope",
sendWith: "modEnter",
newTaskApprovals: "ask",
defaults: { claude: { model: "opus", effort: 3 }, codex: "x" },
},
}).agents;
expect(stored).toMatchObject({
thinking: "collapsed",
toolCalls: "grouped",
sendWith: "modEnter",
newTaskApprovals: "ask",
defaults: { claude: { model: "opus" }, codex: {} },
});
expect(validateSettings({ agents: { newTaskApprovals: "never" } }).agents.newTaskApprovals).toBe("bypass");
});
});