The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
/**
* Tests for McpStatusBadge — renders the i18n'd label and a11y role
* for each ServerStatus, and forwards custom className.
*/
import { render, screen } from '@testing-library/react';
import { describe, expect, it } from 'vitest';
import McpStatusBadge from './McpStatusBadge';
import type { ServerStatus } from './types';
describe('McpStatusBadge', () => {
it.each<[ServerStatus, string]>([
['connected', 'Connected'],
['connecting', 'Connecting'],
['disconnected', 'Disconnected'],
['unauthorized', 'Sign in needed'],
['error', 'Error'],
])('renders i18n label for status=%s', (status, expectedLabel) => {
render(<McpStatusBadge status={status} />);
expect(screen.getByRole('status')).toHaveTextContent(expectedLabel);
});
it('renders the disabled status badge with label and italic style', () => {
render(<McpStatusBadge status="disabled" />);
const badge = screen.getByRole('status');
expect(badge).toHaveTextContent('Disabled');
expect(badge.className).toContain('italic');
});
it('exposes role="status" and aria-live="polite" for assistive tech', () => {
render(<McpStatusBadge status="connecting" />);
const badge = screen.getByRole('status');
expect(badge).toHaveAttribute('aria-live', 'polite');
});
it('falls back to the disconnected style for an unknown status value', () => {
// ServerStatus is a closed union, but the runtime fallback exists for
// forward-compat with possible future Rust-side variants — exercise it.
render(<McpStatusBadge status={'spawning' as ServerStatus} />);
expect(screen.getByRole('status')).toHaveTextContent('Disconnected');
});
it('appends the optional className without dropping the built-in classes', () => {
render(<McpStatusBadge status="connected" className="ml-2 my-custom-class" />);
const badge = screen.getByRole('status');
expect(badge.className).toContain('my-custom-class');
expect(badge.className).toContain('ml-2');
// Built-in look-and-feel preserved: shared outline chip shape, with the
// connected/success tone carried by the status dot, not the fill.
expect(badge.className).toContain('rounded-md');
expect(badge.querySelector('[data-slot="badge-dot"]')?.className).toContain('bg-sage-500');
});
});