import { App } from '@inertiajs/react'; import { renderToStaticMarkup } from 'react-dom/server'; import { expect, test } from 'vitest'; import ProcurementReports from '@/pages/reports/procurement'; test.each([false, true])( 'report shortcuts have matching sections and preserve the filtered report without exposing absent financial sections (%s)', (operational) => { const Screen = () => ( ); const html = renderToStaticMarkup( , ); expect(html).toContain('aria-label="Secções dos relatórios"'); expect(html).toContain('href="#report-filters"'); expect(html).toContain('id="report-filters"'); // The sticky workspace header previously covered anchor destinations. for (const target of html.matchAll( /]*id="report-[^"]+"[^>]*>/g, )) { expect(target[0]).toContain('tabindex="-1"'); expect(target[0]).toContain('scroll-mt-24 lg:scroll-mt-72'); } expect(html.includes('href="#report-operational"')).toBe(operational); expect(html.includes('id="report-operational"')).toBe(operational); for (const absent of [ 'payables', 'deliveries', 'payments', 'contracts', ]) { expect(html).not.toContain(`href="#report-${absent}"`); expect(html).not.toContain(`id="report-${absent}"`); } expect(html).toContain( '/relatorios/compras.csv?status=pending&department_id=7', ); }, );