import test from 'node:test'; import assert from 'node:assert/strict'; import fs from 'node:fs'; import {createRequire} from 'node:module'; import React from 'react'; import {renderToStaticMarkup} from 'react-dom/server'; import ts from 'typescript'; const require=createRequire(import.meta.url),module={exports:{}}; const code=ts.transpileModule(fs.readFileSync(new URL('../../resources/js/pages/dashboard.tsx',import.meta.url),'utf8'),{compilerOptions:{module:ts.ModuleKind.CommonJS,jsx:ts.JsxEmit.ReactJSX}}).outputText; new Function('require','module','exports',code)(name=>name==='@inertiajs/react'?{Head:()=>null,Link:({children,href,...props})=>React.createElement('a',{href,...props},children)}:name==='react/jsx-runtime'?require(name):name==='@/routes'?{dashboard:()=>'/dashboard'}:{default:()=>null},module,module.exports); test('each manager dashboard menu anchor resolves to a real section',()=>{ const html=renderToStaticMarkup(React.createElement(module.exports.default,{summary:{requestsByStatus:{},publishedOpportunities:0,draftOpportunities:0,activeSectors:0,recentRequests:[]},workQueue:null})); for(const id of ['meu-trabalho','manifestacoes','indicadores-oportunidades','pedidos-recentes','accoes-rapidas'])assert.match(html,new RegExp('id="'+id+'"')); assert.match(html,/Painel do portal/); }); test('investor section remains distinct from administrative summary',()=>{ const html=renderToStaticMarkup(React.createElement(module.exports.default,{summary:null,investorPath:{contexts:[],current:null}})); assert.match(html,/id="meus-investimentos"/);assert.doesNotMatch(html,/id="manifestacoes"/); });