import fs from 'node:fs';import assert from 'node:assert/strict';import {createRequire} from 'node:module';import {pathToFileURL} from 'node:url';import {transformWithOxc} from 'vite';import {ContextTransition} from '../resources/js/context-transition.js';import React from 'react';import {renderToStaticMarkup} from 'react-dom/server';
const require=createRequire(import.meta.url),root=JSON.parse(fs.readFileSync('C:/laragon/data/sgf-tempo/run/modular-regression-current.json')).root+'/private/receipt-composition-cc50a276c10c';let source=fs.readFileSync('resources/js/WorkshopOrderList.jsx','utf8').replace("from 'react'",'from '+JSON.stringify(pathToFileURL(require.resolve('react')).href)).replace("from './workshop-menu.js'",'from '+JSON.stringify(pathToFileURL(process.cwd()+'/resources/js/workshop-menu.js').href));const compiled=await transformWithOxc(source,'WorkshopOrderList.jsx',{jsx:{runtime:'classic'}}),{default:List,WorkshopOrderRow}=await import('data:text/javascript;base64,'+Buffer.from(compiled.code).toString('base64')),rows=JSON.parse(fs.readFileSync(root+'/workshop-orders-sample-private.json')).orders.data,checks=[],ok=(v,n)=>{assert(v,n);checks.push(n);};for(const row of rows){const html=renderToStaticMarkup(React.createElement(WorkshopOrderRow,{row,navigate(){}}));ok(html.includes(row.reference)&&html.includes(row.client)&&html.includes(row.equipment),'actual identity '+row.id);ok(html.includes('apontados')&&html.includes('verificados')&&html.includes('sem verificação favorável'),'time and pending semantics '+row.id);ok(html.includes('Abrir ordem e evidências'),'explicit continuation '+row.id);}const html=renderToStaticMarkup(React.createElement(List,{context:{token:'test'},api(){throw Error('No network during SSR');}}));ok(html.includes('value="25"')&&html.includes('value="100"'),'server page sizes offered');ok(html.includes('Registos verificados')&&!html.includes('value="delivered"'),'only existing resource states offered');const escaped=renderToStaticMarkup(React.createElement(WorkshopOrderRow,{row:{...rows[0],reference:''}}));ok(!escaped.includes('