Summary
Add a unit test for the NodeCard React component to verify it renders node information correctly.
Prerequisites
This issue depends on #103 (vitest setup). Complete that issue first or work on this after vitest is configured.
Current State
- File:
control-plane/web/client/src/components/NodeCard.tsx
- Test: None
What to Test
- Basic rendering: Component renders without crashing
- Node information display: Node ID, status, and metadata are displayed
- Status indicators: Correct status badge/icon for different states (online, offline, error)
- Action buttons: Buttons render and are clickable
- Props handling: Component handles various node configurations
Example Test Structure
import { render, screen } from '@testing-library/react';
import { NodeCard } from './NodeCard';
describe('NodeCard', () => {
const mockNode = {
id: 'test-node-1',
status: 'online',
// ... other required props
};
it('renders node information', () => {
render(<NodeCard node={mockNode} />);
expect(screen.getByText('test-node-1')).toBeInTheDocument();
});
it('displays correct status for online node', () => {
render(<NodeCard node={mockNode} />);
expect(screen.getByText('online')).toBeInTheDocument();
});
it('displays correct status for offline node', () => {
render(<NodeCard node={{ ...mockNode, status: 'offline' }} />);
expect(screen.getByText('offline')).toBeInTheDocument();
});
});
Acceptance Criteria
Files
- Source:
control-plane/web/client/src/components/NodeCard.tsx
- Test:
control-plane/web/client/src/components/NodeCard.test.tsx (new)
Using AI to solve this issue? Read our AI-Assisted Contributions guide for testing requirements, prompt strategies, and common pitfalls to avoid.
Summary
Add a unit test for the NodeCard React component to verify it renders node information correctly.
Prerequisites
This issue depends on #103 (vitest setup). Complete that issue first or work on this after vitest is configured.
Current State
control-plane/web/client/src/components/NodeCard.tsxWhat to Test
Example Test Structure
Acceptance Criteria
NodeCard.test.tsxadjacent to the componentnpm testFiles
control-plane/web/client/src/components/NodeCard.tsxcontrol-plane/web/client/src/components/NodeCard.test.tsx(new)