test(260923-le6): PMG-Teilsumme ohne Haelfte muss null sein

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-23 15:30:31 +02:00
parent 6530ae503b
commit c13d657e41
@@ -237,4 +237,51 @@ describe('normalizePmg (Aufgabe 3, <behavior>)', () => {
virusCount: null,
});
});
it('nur eine Haelfte vorhanden -> null (Spam, nur spamcount_in)', () => {
const body = { data: { spamcount_in: 10 } };
const { metrics } = normalizePmg(body);
expect(metrics.spamCount).toBeNull();
});
it('nur eine Haelfte vorhanden -> null (Spam, nur spamcount_out)', () => {
const body = { data: { spamcount_out: 2 } };
const { metrics } = normalizePmg(body);
expect(metrics.spamCount).toBeNull();
});
it('nur eine Haelfte vorhanden -> null (Viren, nur viruscount_in)', () => {
const body = { data: { viruscount_in: 1 } };
const { metrics } = normalizePmg(body);
expect(metrics.virusCount).toBeNull();
});
it('nur eine Haelfte vorhanden -> null (Viren, nur viruscount_out)', () => {
const body = { data: { viruscount_out: 3 } };
const { metrics } = normalizePmg(body);
expect(metrics.virusCount).toBeNull();
});
it('eine Haelfte ist nicht lesbar -> null (Spam, spamcount_out ist Text)', () => {
const body = { data: { spamcount_in: 10, spamcount_out: 'abc' } };
const { metrics } = normalizePmg(body);
expect(metrics.spamCount).toBeNull();
});
it('Unabhaengigkeit der Paare: Spam unvollstaendig, Viren vollstaendig -> spamCount null, virusCount 1, countIn/countOut unberuehrt', () => {
const body = {
data: {
count_in: 100,
count_out: 50,
spamcount_in: 10,
viruscount_in: 1,
viruscount_out: 0,
},
};
const { metrics } = normalizePmg(body);
expect(metrics.spamCount).toBeNull();
expect(metrics.virusCount).toBe(1);
expect(metrics.countIn).toBe(100);
expect(metrics.countOut).toBe(50);
});
});