Skip to content

Commit 8686e16

Browse files
committed
Add Timeline test for monitored authors
Add ui/src/components/dashboard/Timeline.test.tsx to verify Timeline falls back to monitored_authors when proposition details lack raw authorship. The test renders the component with a sample DashboardActivityPropositionOut and asserts the monitored author's name, party and state are displayed using vitest and React Testing Library.
1 parent 0511e43 commit 8686e16

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { render, screen } from '@testing-library/react';
2+
import { describe, expect, it } from 'vitest';
3+
4+
import type { DashboardActivityPropositionOut } from '@/api/types';
5+
import { Timeline } from './Timeline';
6+
7+
describe('Timeline', () => {
8+
it('uses monitored authors when proposition details do not expose raw authorship', () => {
9+
const camaraAmendment: DashboardActivityPropositionOut = {
10+
id: 48475,
11+
proposition_code: 2624861,
12+
title: 'EMC 1/2026',
13+
link: 'https://www.camara.leg.br/proposicoesWeb/fichadetramitacao?idProposicao=2624861',
14+
proposition_acronym: 'EMC',
15+
proposition_number: 1,
16+
presentation_year: 2026,
17+
agency_id: null,
18+
proposition_type_id: null,
19+
proposition_status_id: null,
20+
current_status: 'Apresentação do REQ n. 3131/2026',
21+
proposition_description: 'Emenda à PEC',
22+
presentation_date: '2026-05-14',
23+
presentation_month: 5,
24+
summary: null,
25+
details: {},
26+
created_at: '2026-05-14T00:00:00',
27+
updated_at: '2026-05-14T00:00:00',
28+
monitored_authors: [
29+
{
30+
id: 86,
31+
name: 'Adilson Barroso',
32+
full_name: 'ADILSON BARROSO OLIVEIRA',
33+
party: 'PL',
34+
state_elected: 'SP',
35+
type: 'Deputado',
36+
},
37+
],
38+
};
39+
40+
render(<Timeline propositions={[camaraAmendment]} votes={[]} />);
41+
42+
expect(screen.getByText('Adilson Barroso PL - SP')).toBeInTheDocument();
43+
});
44+
});

0 commit comments

Comments
 (0)