Files
oh-my-pi/packages/coding-agent/test/issue-953-repro.test.ts
T
can1357 6d00cc1f08 test(ai): added reasoning model helper for OpenAI response history tests
- Added getOpenAIReasoningModel to wrap the bundled gpt-5-mini model with a non-gpt-5 name in tests.
- Replaced all OpenAI responses test model constructions using gpt-5-mini with the new helper to bypass reasoning-model branching during payload assertions.
2026-05-14 06:23:55 +02:00

62 lines
1.8 KiB
TypeScript

import { beforeAll, describe, expect, it } from "bun:test";
import type { SegmentContext } from "../src/modes/components/status-line/segments";
import { renderSegment } from "../src/modes/components/status-line/segments";
import { initTheme, theme } from "../src/modes/theme/theme";
beforeAll(async () => {
await initTheme();
});
function createCtx(usage: Partial<SegmentContext["usageStats"]>): SegmentContext {
return {
session: {
state: {},
isFastModeEnabled: () => false,
modelRegistry: { isUsingOAuth: () => false },
sessionManager: undefined,
} as unknown as SegmentContext["session"],
width: 120,
options: {},
planMode: null,
loopMode: null,
goalMode: null,
usageStats: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
premiumRequests: 0,
cost: 0,
tokensPerSecond: null,
...usage,
},
contextPercent: 0,
contextWindow: 0,
autoCompactEnabled: false,
subagentCount: 0,
sessionStartTime: Date.now(),
git: {
branch: null,
status: null,
pr: null,
},
};
}
describe("issue #953 cache status line icons", () => {
it("renders cache reads as cache output and cache writes as cache input", () => {
const cacheRead = renderSegment("cache_read", createCtx({ cacheRead: 28_919_910 }));
const cacheWrite = renderSegment("cache_write", createCtx({ cacheWrite: 1_759_992 }));
expect(cacheRead.visible).toBe(true);
expect(cacheRead.content).toContain(theme.icon.cache);
expect(cacheRead.content).toContain(theme.icon.output);
expect(cacheRead.content).not.toContain(theme.icon.input);
expect(cacheWrite.visible).toBe(true);
expect(cacheWrite.content).toContain(theme.icon.cache);
expect(cacheWrite.content).toContain(theme.icon.input);
expect(cacheWrite.content).not.toContain(theme.icon.output);
});
});