fix: complete InvesteMoz validation and error corrections
This commit is contained in:
@@ -1,9 +1,36 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs';
|
||||
import {irpcBook,irpcReportRows,irpcPreparationHtml} from '../../resources/js/lib/irpc-withholdings.ts';
|
||||
test('each saved calculation identifies income category rate and Portuguese nature without recalculation',()=>{
|
||||
const d=JSON.parse(fs.readFileSync(new URL('./fixtures/irpc-grouped-preserved.json',import.meta.url),'utf8')),before=JSON.stringify(irpcBook(d)),rows=irpcReportRows(d);
|
||||
assert.equal(rows.length,6);for(const r of rows){assert.match(r[2],/enquadramento:/);assert.match(r[2],/taxa:(10|20)%/);assert.match(r[3],/Retenção definitiva|Imposto por conta/);}
|
||||
assert.match(rows[2][2],/Propriedade intelectual\/industrial/);assert.match(rows[3][2],/Serviços de telecomunicações/);assert.match(rows[4][3],/Imposto por conta/);assert.match(rows[0][3],/Retenção definitiva/);assert.equal(JSON.stringify(irpcBook(d)),before);const html=irpcPreparationHtml(d);assert.match(html,/Retenção definitiva/);assert.match(html,/Imposto por conta/);assert.ok(!html.includes(';definitive;'));
|
||||
import {
|
||||
irpcBook,
|
||||
irpcReportRows,
|
||||
irpcPreparationHtml,
|
||||
} from '../../resources/js/lib/irpc-withholdings.ts';
|
||||
void test('each saved calculation identifies income category rate and Portuguese nature without recalculation', () => {
|
||||
const d = JSON.parse(
|
||||
fs.readFileSync(
|
||||
new URL(
|
||||
'./fixtures/irpc-grouped-preserved.json',
|
||||
import.meta.url,
|
||||
),
|
||||
'utf8',
|
||||
),
|
||||
),
|
||||
before = JSON.stringify(irpcBook(d)),
|
||||
rows = irpcReportRows(d);
|
||||
assert.equal(rows.length, 6);
|
||||
for (const r of rows) {
|
||||
assert.match(r[2], /enquadramento:/);
|
||||
assert.match(r[2], /taxa:(10|20)%/);
|
||||
assert.match(r[3], /Retenção definitiva|Imposto por conta/);
|
||||
}
|
||||
assert.match(rows[2][2], /Propriedade intelectual\/industrial/);
|
||||
assert.match(rows[3][2], /Serviços de telecomunicações/);
|
||||
assert.match(rows[4][3], /Imposto por conta/);
|
||||
assert.match(rows[0][3], /Retenção definitiva/);
|
||||
assert.equal(JSON.stringify(irpcBook(d)), before);
|
||||
const html = irpcPreparationHtml(d);
|
||||
assert.match(html, /Retenção definitiva/);
|
||||
assert.match(html, /Imposto por conta/);
|
||||
assert.ok(!html.includes(';definitive;'));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user