25 lines
1.9 KiB
JavaScript
25 lines
1.9 KiB
JavaScript
import fs from 'node:fs';
|
|
import {economicCase} from '../tests/frontend/helpers/irpc-economic-case.mjs';
|
|
import {recordAnnual, saveAnnualBook} from '../resources/js/lib/irpc-annual-settlement.ts';
|
|
const cases = {};
|
|
for (const name of ['payable', 'combined', 'quota', 'prior-use', 'duplicate', 'missing-gross-up', 'article40', 'shared-paper', 'partial-parcel', 'fractional', 'recoverable']) {
|
|
const c = economicCase(name === 'combined');
|
|
const previous = structuredClone(c.b); delete previous.economicCredits;
|
|
c.b.history = [recordAnnual(c.d, previous, '2026-10-28T12:00:00+02:00').result];
|
|
const r = c.b.economicCredits.rows[0], p = c.b.internationalCredits.positions[0], f = p.payments[0];
|
|
if (name === 'quota') r.nationalLimit = '5';
|
|
if (name === 'prior-use') r.previousUse.amount = '3';
|
|
if (name === 'duplicate' || name === 'shared-paper') {
|
|
Object.assign(f, {issuer: r.taxIssuer, document: r.taxDocument, proofAmount: '20', parcel: name === 'duplicate' ? r.taxParcel : 'foreign-tax-line', parcelReference: 'SYNTHETIC QA documented tax line in shared paper, no actual tax evidence'});
|
|
}
|
|
if (name === 'missing-gross-up') r.grossUpIncluded = '';
|
|
if (name === 'article40') r.article40 = 'yes';
|
|
if (name === 'partial-parcel') f.parcel = 'foreign-tax-line';
|
|
if (name === 'fractional') Object.assign(r, {proofAmount: '0.01', taxAmount: '0.01', grossUpIncluded: '0.006'});
|
|
if (name === 'recoverable') {f.proofAmount = '2000'; f.amount = '2000'; p.nationalLimit = '2000'; p.incomeAmount = '6250';}
|
|
c.d.modelo_a_snapshot = saveAnnualBook(c.d, recordAnnual(c.d, c.b, '2026-10-28T14:00:00+02:00'));
|
|
cases[name] = c.d;
|
|
}
|
|
fs.writeFileSync(new URL('../tests/frontend/fixtures/irpc-economic-preserved.json', import.meta.url), JSON.stringify({synthetic: true, actualTaxEvidence: false, cases}));
|
|
console.log('Prepared eleven synthetic economic-credit cases with accepted annual/carry history.');
|