import { App, router } from '@inertiajs/react';
import { renderToStaticMarkup } from 'react-dom/server';
import { afterEach, expect, test, vi } from 'vitest';
import Award from '@/pages/purchases/award';
import { money } from '@/types/procurement';
afterEach(() => vi.restoreAllMocks());
const option = {
allocation_key: 'qa-a',
line_id: 12,
centre_id: 4,
subtotal: '50.00',
total: '50.00',
line_label: 'Artigo sintético',
centre_label: 'Centro sintético',
};
function render(
currency = 'MZN',
reference: object | null = null,
actorId = 7,
) {
return renderToStaticMarkup(
,
);
}
function rememberSelection() {
vi.spyOn(router, 'restore').mockImplementation((key) =>
key === 'award-selection:3:7:2:4:data'
? {
quotation_id: '1',
justification: '',
delivery_date: '',
delivery_location: '',
reason: '',
budget_distribution_preparation: [option],
}
: undefined,
);
}
test('quote is chosen before explicit allocations and a different actor cannot inherit the selection', () => {
expect(render()).not.toContain('