@@ -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
|
||||
|
||||
Reference in New Issue
Block a user