feat: Warnfenster und Planungs-Hinweis bei möglicher Doppelzählung (A12-T4)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
const test = require('node:test');
|
||||
const assert = require('node:assert');
|
||||
const D = require('../../app/static/doppelzaehlung.js');
|
||||
|
||||
const body = { detail: { code: 'doppelzaehlung_kredit', meldung: 'M',
|
||||
konflikte: [{ posten: 'Rate Auto', posten_betrag: '-1234.50', kredit: 'Auto', kredit_rate: '1234.50' }] } };
|
||||
|
||||
test('parseDetail erkennt nur 409 mit Code', () => {
|
||||
assert.equal(D.parseDetail({ status: 409, responseText: JSON.stringify(body) }).code, 'doppelzaehlung_kredit');
|
||||
assert.equal(D.parseDetail({ status: 409, responseText: '{"detail":"Kategorie existiert bereits"}' }), null);
|
||||
assert.equal(D.parseDetail({ status: 422, responseText: JSON.stringify(body) }), null);
|
||||
assert.equal(D.parseDetail({ status: 409, responseText: 'kein json' }), null);
|
||||
assert.equal(D.parseDetail(null), null);
|
||||
});
|
||||
|
||||
test('konfliktText deutsch formatiert', () => {
|
||||
assert.equal(D.konfliktText(body.detail.konflikte[0]),
|
||||
'Posten „Rate Auto“ (-1.234,50 €) ↔ Kredit „Auto“ (Rate 1.234,50 €)');
|
||||
});
|
||||
Reference in New Issue
Block a user