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>
37 lines
1.5 KiB
TypeScript
37 lines
1.5 KiB
TypeScript
import { describe, it, expect } from 'vitest'
|
|
import { deriveStepsFromStatus } from '../../../src/renderer/src/utils/pipelineSteps'
|
|
|
|
describe('deriveStepsFromStatus()', () => {
|
|
it('should mark every step pending when there is no session yet', () => {
|
|
const steps = deriveStepsFromStatus(null)
|
|
expect(steps).toHaveLength(7)
|
|
expect(steps.every((s) => s.status === 'pending')).toBe(true)
|
|
})
|
|
|
|
it('should mark the objective step active during objective_discovery', () => {
|
|
const steps = deriveStepsFromStatus('objective_discovery')
|
|
expect(steps.at(0)?.status).toBe('active')
|
|
expect(steps.slice(1).every((s) => s.status === 'pending')).toBe(true)
|
|
})
|
|
|
|
it('should mark the objective step done and mapping active once objective_validated', () => {
|
|
const steps = deriveStepsFromStatus('objective_validated')
|
|
expect(steps.at(0)?.status).toBe('done')
|
|
expect(steps.at(1)?.status).toBe('active')
|
|
})
|
|
|
|
it('should mark every step done once completed', () => {
|
|
const steps = deriveStepsFromStatus('completed')
|
|
expect(steps.every((s) => s.status === 'done')).toBe(true)
|
|
})
|
|
|
|
it('should mark steps before the current one as done and steps after as pending', () => {
|
|
const steps = deriveStepsFromStatus('researching')
|
|
expect(steps.at(0)?.status).toBe('done')
|
|
expect(steps.at(1)?.status).toBe('done')
|
|
expect(steps.at(2)?.status).toBe('done')
|
|
expect(steps.at(3)?.status).toBe('active')
|
|
expect(steps.at(4)?.status).toBe('pending')
|
|
})
|
|
})
|