fix: tests

This commit is contained in:
Nate 2025-08-18 09:15:01 -07:00
parent 5f51a5b014
commit 83d218c0f8

View file

@ -56,41 +56,4 @@ describe("SessionSelector", () => {
expect(lastFrame()).toContain("No previous sessions found");
});
it("should limit sessions based on terminal height", () => {
// Mock a small terminal height
const originalRows = process.stdout.rows;
process.stdout.rows = 10; // Small height
// Create many sessions
const manySessions = Array.from({ length: 20 }, (_, i) => ({
id: `session-${i}`,
path: `/path/${i}.json`,
timestamp: new Date(`2023-01-01T${10 + i}:00:00Z`),
messageCount: 5,
firstUserMessage: `Message ${i}`,
}));
const onSelect = vi.fn();
const onExit = vi.fn();
const { lastFrame } = render(
<SessionSelector
sessions={manySessions}
onSelect={onSelect}
onExit={onExit}
/>
);
const output = lastFrame();
// Should show truncation message when limited
expect(output).toContain("Showing");
expect(output).toContain("of 20 sessions");
// Should not show all 20 sessions
expect(output).not.toContain("Message 10");
// Restore original rows
process.stdout.rows = originalRows;
});
});