import { App } from '@inertiajs/react'; import { renderToStaticMarkup } from 'react-dom/server'; import { expect, test } from 'vitest'; import EquipmentShow from '@/pages/equipment/show'; const page = { data: [], total: 0, current_page: 1, last_page: 1, prev_page_url: null, next_page_url: null, }; function render( reference: { record_key: string; code: string; name: string; version: number; state: string; href: string; } | null, ) { return renderToStaticMarkup( , ); } test('equipment shows an explicit current asset reference and its existing purchase trace without rewriting its origins', () => { const html = render({ record_key: 'qa-key', code: 'ASSET-QA', name: 'Nome actual ', version: 2, state: 'archived', href: '/projectos-imobilizado?history=qa-key', }); expect(html).toContain('ASSET-QA'); expect(html).toContain('Nome actual <QA>'); expect(html).toContain('versão 2 · arquivada'); expect(html).toContain('href="/projectos-imobilizado?history=qa-key"'); expect(html).toContain('Consultar aquisição e recepções'); expect(html).toContain('documentos de compra conservam a referência'); expect(html).toContain('Requisições de compra associadas'); }); test('an unavailable or unauthorized asset reference does not introduce an empty panel or action', () => { const html = render(null); expect(html).not.toContain('Imobilizado no cadastro de Compras'); expect(html).not.toContain('Consultar aquisição e recepções'); expect(html).toContain('Equipamento sintético'); });