From 4596ced82eb43b0f9d971845949e56e2c2cec117 Mon Sep 17 00:00:00 2001 From: Mark McLaughlin Date: Tue, 10 Feb 2026 10:55:51 -0800 Subject: [PATCH] test: Add fixed width card case and restore mocks after each test --- .../src/ui/components/shared/Card.test.tsx | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/packages/cli/src/ui/components/shared/Card.test.tsx b/packages/cli/src/ui/components/shared/Card.test.tsx index b5dc0c5d86..3c738f9166 100644 --- a/packages/cli/src/ui/components/shared/Card.test.tsx +++ b/packages/cli/src/ui/components/shared/Card.test.tsx @@ -7,10 +7,14 @@ import { render } from '../../../test-utils/render.js'; import { Card } from './Card.js'; import { Text } from 'ink'; -import { describe, it, expect } from 'vitest'; +import { describe, it, expect, afterEach, vi } from 'vitest'; import { ToolCallStatus } from '../../types.js'; describe('Card', () => { + afterEach(() => { + vi.restoreAllMocks(); + }); + it.each([ { status: ToolCallStatus.Pending, @@ -47,11 +51,25 @@ describe('Card', () => { prefix: true, body: 'Listed 39 item(s).', }, + { + status: ToolCallStatus.Pending, + title: 'Fixed Width Card', + suffix: undefined, + prefix: true, + width: 40, + body: 'This card has a fixed width of 40 characters.', + }, ] as const)( - 'renders a $status card with prefix=$prefix', - ({ status, title, suffix, prefix, body }) => { + "renders '$title' card with status=$status and prefix=$prefix", + ({ status, title, suffix, prefix, body, width }) => { const { lastFrame } = render( - + {body} , );