30 lines
1.3 KiB
TypeScript
30 lines
1.3 KiB
TypeScript
import { render, screen } from '@testing-library/react'
|
|
import PipelineStepper from '@/features/run-detail/components/PipelineStepper'
|
|
import { AGENT_STEPS } from '@/lib/types/run'
|
|
import type { StepStatus } from '@/lib/types/agents'
|
|
|
|
function makeSteps(overrides: Partial<Record<string, StepStatus>> = {}) {
|
|
return Object.fromEntries(
|
|
AGENT_STEPS.map((s) => [s, overrides[s] ?? 'pending' as StepStatus])
|
|
) as Record<string, StepStatus>
|
|
}
|
|
|
|
test('renders 4 phase labels', () => {
|
|
render(<PipelineStepper steps={makeSteps()} />)
|
|
expect(screen.getByText('Analysts')).toBeInTheDocument()
|
|
expect(screen.getByText('Researchers')).toBeInTheDocument()
|
|
expect(screen.getByText('Trader')).toBeInTheDocument()
|
|
expect(screen.getByText('Risk')).toBeInTheDocument()
|
|
})
|
|
|
|
test('phase is done when all its steps are done', () => {
|
|
const steps = makeSteps({
|
|
market_analyst: 'done', news_analyst: 'done',
|
|
fundamentals_analyst: 'done', social_analyst: 'done',
|
|
})
|
|
const { container } = render(<PipelineStepper steps={steps} />)
|
|
// The Analysts phase dot should have done styling (text-[#adc6ff])
|
|
// We verify by checking the component renders without error and has 4 phases
|
|
expect(screen.getAllByText(/Analysts|Researchers|Trader|Risk/).length).toBeGreaterThanOrEqual(4)
|
|
})
|