Files
ForgeBase/Max Avatar/tests/unit/components/PipelineStepper.test.tsx
T
williamandClaude Sonnet 5 309db80add feat(pipeline): add InputBar, ChatBubble, AvatarStatusIndicator, PipelineStepper and ObjectiveValidationCard
Shell and Agent 1 UI components per docs/Max_Composants_Frontend.md:

- InputBar: send on Enter, newline on Shift+Enter, mic toggle (STT
  itself stays in the main process).
- ChatBubble: max/user variants reusing the existing chat-bubble
  design-system classes, simple Markdown via react-markdown+remark-gfm.
- AvatarStatusIndicator: purely visual, no status computed here.
- PipelineStepper + utils/pipelineSteps.ts: the stepper itself only
  renders the `steps` prop as given (never computes status); the
  session.status -> step list derivation lives in a separate pure
  function the store/App call, per the doc's explicit rule that the
  component must never calculate status itself.
- ObjectiveValidationCard: single-field-at-a-time editing, locked and
  irreversible once onConfirm resolves.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-31 21:58:38 +01:00

43 lines
1.6 KiB
TypeScript

import { describe, it, expect } from 'vitest'
import { render, screen } from '@testing-library/react'
import PipelineStepper from '../../../src/renderer/src/components/PipelineStepper'
describe('<PipelineStepper />', () => {
it('should render each step with its own status class, unchanged from props', () => {
const { container } = render(
<PipelineStepper
steps={[
{ id: 1, label: 'Objectif', status: 'done' },
{ id: 2, label: 'Cartographie', status: 'active', subLabel: 'En cours' },
{ id: 3, label: 'Niveau', status: 'pending' }
]}
/>
)
expect(container.querySelectorAll('.step--done')).toHaveLength(1)
expect(container.querySelectorAll('.step--active')).toHaveLength(1)
expect(container.querySelectorAll('.step--pending')).toHaveLength(1)
expect(screen.getByText('Objectif')).toBeInTheDocument()
expect(screen.getByText('Cartographie')).toBeInTheDocument()
})
it('should only show the sub-label for the active step', () => {
render(
<PipelineStepper
steps={[
{ id: 1, label: 'Objectif', status: 'done', subLabel: 'ignore' },
{ id: 2, label: 'Cartographie', status: 'active', subLabel: 'En cours' }
]}
/>
)
expect(screen.queryByText('ignore')).not.toBeInTheDocument()
expect(screen.getByText('En cours')).toBeInTheDocument()
})
it('should show a checkmark instead of the number for a done step', () => {
render(<PipelineStepper steps={[{ id: 1, label: 'Objectif', status: 'done' }]} />)
expect(screen.getByText('✓')).toBeInTheDocument()
})
})