@@ -0,0 +1,92 @@
|
||||
import { App } from '@inertiajs/react';
|
||||
import { renderToStaticMarkup } from 'react-dom/server';
|
||||
import { expect, test } from 'vitest';
|
||||
import Requests from '@/pages/stock/requests';
|
||||
|
||||
test('production use is available and the stored declared reference is escaped without suggesting external validation', () => {
|
||||
const html = renderToStaticMarkup(
|
||||
<App
|
||||
initialComponent={Requests}
|
||||
initialPage={{
|
||||
component: 'stock/requests',
|
||||
url: '/stock/requisicoes',
|
||||
version: null,
|
||||
clearHistory: false,
|
||||
encryptHistory: true,
|
||||
props: {
|
||||
errors: {},
|
||||
filters: {
|
||||
view: 'all',
|
||||
state: '',
|
||||
search: '',
|
||||
warehouse_id: null,
|
||||
},
|
||||
views: [],
|
||||
states: {},
|
||||
checkedAt: '2026-11-22T12:00:00Z',
|
||||
ready: true,
|
||||
canPrepare: true,
|
||||
items: [],
|
||||
warehouses: [],
|
||||
costCenters: [],
|
||||
equipment: [],
|
||||
records: {
|
||||
total: 1,
|
||||
prev_page_url: null,
|
||||
next_page_url: null,
|
||||
data: [
|
||||
{
|
||||
id: 9,
|
||||
status: 'draft',
|
||||
snapshot: {
|
||||
requester: { name: 'QA' },
|
||||
warehouse: { name: 'QA' },
|
||||
cost_center: { code: 'QA', name: 'QA' },
|
||||
destination: 'Linha QA',
|
||||
reason: 'Synthetic data',
|
||||
priority: 'normal',
|
||||
lines: [
|
||||
{
|
||||
item: {
|
||||
id: 1,
|
||||
code: 'QA',
|
||||
name: 'Insumo QA',
|
||||
unit: 'kg',
|
||||
},
|
||||
quantity_milli: 1000,
|
||||
use: 'production',
|
||||
destination: 'Linha QA',
|
||||
equipment: null,
|
||||
production: {
|
||||
reference: 'OP-<QA>',
|
||||
verification: 'user_supplied',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
health: {
|
||||
lines: [],
|
||||
needs_reservation: false,
|
||||
needs_check: false,
|
||||
unconfirmed_deliveries: 0,
|
||||
delivery_ready: false,
|
||||
},
|
||||
actions: {
|
||||
canSubmit: false,
|
||||
canReview: false,
|
||||
canDeliver: false,
|
||||
canManageReservation: false,
|
||||
canReceive: false,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
expect(html).toContain('value="production"');
|
||||
expect(html).toContain('Insumos para produção');
|
||||
expect(html).toContain('Referência declarada: OP-<QA>');
|
||||
expect(html).not.toContain('OP-<QA>');
|
||||
});
|
||||
Reference in New Issue
Block a user