فینورا پرو - سامانه جامع حسابداری و صدور فاکتور

test(A02): regress empty records, duplicate mapping and empty claimed totals

davoodmehraban89 committed Oct 18, 2026 at 07:09 UTC b65d66367b5c66996bfd5dd80065fdfc1baa1602
1 file changed +33
tests/a02-holoo-delimited-export.test.mjs
+33
@@ -200,3 +200,36 @@ test('A02: bounded combined diagnostics preserve total count without leaking raw
200 assert.ok(!JSON.stringify(result).includes('123456'));
201 assert.ok(!JSON.stringify(result).includes('999999'));
202 });
203 +
204 +test('A02: blank CSV records never disappear from source counts', () => {
205 + assert.throws(
206 + () => parseStrictDelimitedRows('id,name\\nC1,A\\n\\nC2,B\\n'),
207 + /CSV_EMPTY_RECORD/
208 + );
209 + assert.throws(
210 + () => parseStrictDelimitedRows('id\\n""\\n'),
211 + /CSV_EMPTY_RECORD/
212 + );
213 + assert.deepEqual(
214 + parseStrictDelimitedRows('id,name\\nC1,A\\n').rows,
215 + [{ id: 'C1', name: 'A' }]
216 + );
217 +});
218 +
219 +test('A02: ambiguous mappings cannot reuse one source column for different fields', () => {
220 + const sample = fixture();
221 + sample.mappings.invoices.paidAmount = 'gross';
222 + assert.throws(
223 + () => previewHolooDelimitedExport(sample),
224 + /CSV_DUPLICATE_SOURCE_COLUMN_MAPPING/
225 + );
226 +});
227 +
228 +test('A02: supplied empty control claims are rejected, not presented as checked', () => {
229 + const sample = fixture();
230 + sample.declaredControlTotals = {};
231 + assert.throws(
232 + () => previewHolooDelimitedExport(sample),
233 + /CONTROL_TOTALS_SCHEMA_INVALID/
234 + );
235 +});