commit compras2 2911
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-11-29 10:48:22 +02:00
parent 448948a487
commit 7da8d6c87a
64 changed files with 2538 additions and 288 deletions
+15 -1
View File
@@ -4,7 +4,7 @@ import { expect, test } from 'vitest';
import ExpenseAllocation from '../../resources/js/pages/payments/expense-allocation';
import { ProcurementCategoryInsights } from '../../resources/js/components/procurement-category-insights';
function render(canWrite: boolean) {
function render(canWrite: boolean, common = false) {
return renderToStaticMarkup(
<App
initialComponent={ExpenseAllocation}
@@ -15,6 +15,12 @@ function render(canWrite: boolean) {
clearHistory: false,
encryptHistory: true,
props: {
...(common
? {
sourceType: 'common_allocation',
submitUrl: '/afectacoes-fornecedores/1/imputacao',
}
: {}),
errors: {},
canWrite,
actorId: 1,
@@ -63,6 +69,14 @@ test('Finance starts with blank amounts and deliberately chooses whether to reus
expect(html).toContain('Guardar imputação');
});
test('common allocation keeps its own source and returns to the common financial workspace', () => {
const html = render(true, true);
expect(html).toContain('Afectação #1');
expect(html).toContain('href="/supplier-payments"');
expect(html).not.toContain('href="/pagamentos?payment_id=1"');
expect(html).toContain('Guardar imputação');
});
test('category summary preserves unassigned expenses and separates currencies without allocating them automatically', () => {
const html = renderToStaticMarkup(
<ProcurementCategoryInsights