Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

chore: files changed app/src/components/feedback/FeedbackStatusBadge.tsx,app/src/components/feedback

Steven Enamakel84aeb3c52483
diff --git a/app/src/components/feedback/FeedbackStatusBadge.test.tsx b/app/src/components/feedback/FeedbackStatusBadge.test.tsx
new file mode 100644
index 0000000000..dc197e4a9d
--- /dev/null
+++ b/app/src/components/feedback/FeedbackStatusBadge.test.tsx
@@ -0,0 +1,38 @@
+import { render, screen } from '@testing-library/react';
+import { describe, expect, it, vi } from 'vitest';
+
+import type { FeedbackStatus } from '../../types/feedback';
+import FeedbackStatusBadge from './FeedbackStatusBadge';
+
+vi.mock('../../lib/i18n/I18nContext', () => ({ useT: () => ({ t: (k: string) => k }) }));
+
+describe('<FeedbackStatusBadge />', () => {
+ it('renders the label and styling for a known status', () => {
+ render(<FeedbackStatusBadge status="completed" />);
+ const badge = screen.getByText('feedback.status.completed');
+ expect(badge.className).toContain('bg-sage-500/10');
+ });
+
+ it('renders a status the build does not know about instead of throwing', () => {
+ // `FeedbackStatus` is a compile-time union, but `status` comes from the API
+ // and nothing validates it there. An unknown value used to make the style
+ // lookup undefined and `style.pill` throw, which took the whole feedback
+ // page down over a single row's badge.
+ const unknown = 'in_review' as FeedbackStatus;
+ expect(() => render(<FeedbackStatusBadge status={unknown} />)).not.toThrow();
+ expect(screen.getByText('in_review')).toBeInTheDocument();
+ });
+
+ it('does not dress an unknown status as a known one', () => {
+ const unknown = 'in_review' as FeedbackStatus;
+ render(<FeedbackStatusBadge status={unknown} />);
+ const badge = screen.getByText('in_review');
+ expect(badge.className).toContain('text-content-muted');
+ expect(badge.className).not.toContain('bg-sage-500/10');
+ });
+
+ it('survives a missing status', () => {
+ const missing = undefined as unknown as FeedbackStatus;
+ expect(() => render(<FeedbackStatusBadge status={missing} />)).not.toThrow();
+ });
+});
diff --git a/app/src/components/feedback/FeedbackStatusBadge.tsx b/app/src/components/feedback/FeedbackStatusBadge.tsx
index ab0d2b4024..61317fadb7 100644
--- a/app/src/components/feedback/FeedbackStatusBadge.tsx
+++ b/app/src/components/feedback/FeedbackStatusBadge.tsx
@@ -20,7 +20,10 @@ const STATUS_LABEL_KEYS: Record<FeedbackStatus, string> = {
* Style for a status this build does not know about. Neutral on purpose — an
* unrecognised status should not borrow the visual weight of "completed".
*/
-const UNKNOWN_STATUS_STYLE = { pill: 'bg-content-muted/10 text-content-muted', dot: 'bg-content-faint' };
+const UNKNOWN_STATUS_STYLE = {
+ pill: 'bg-content-muted/10 text-content-muted',
+ dot: 'bg-content-faint',
+};
export default function FeedbackStatusBadge({ status }: { status: FeedbackStatus }) {
const { t } = useT();