From b9c48dfd63feb93ddeaac613e91b550e8a7d3d94 Mon Sep 17 00:00:00 2001 From: chahinebrini Date: Thu, 18 Jun 2026 10:19:48 +0200 Subject: [PATCH] test: update stale comments in test fixes --- backend/tests/mail/mail-classifier.test.ts | 18 ++++++++++-------- backend/tests/voice/quota.test.ts | 8 ++++---- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/backend/tests/mail/mail-classifier.test.ts b/backend/tests/mail/mail-classifier.test.ts index b8f0a66..ceb68c2 100644 --- a/backend/tests/mail/mail-classifier.test.ts +++ b/backend/tests/mail/mail-classifier.test.ts @@ -17,7 +17,7 @@ * - Domain-Block (Layer 2) * - Relay-Decoded Block (Layer 2) * - No-Signal → PASS - * - v1.0: Display-Name-only Gambling-Pattern → PASS (kein Score-Beitrag) + * - Display-Name-only Gambling-Pattern "casino" → +30 Score-Beitrag (kann PASS bleiben) */ import { describe, it, expect, vi } from "vitest"; @@ -535,9 +535,9 @@ describe("classifyMail() — End-to-End Pipeline", () => { it("Steffanie-Heier-Fall: 'Fettes Angebot: Spins + 400% Bonus' → BLOCK (score=85)", async () => { // hotmail.com ist keine Gambling-Domain, kein Brand-Match, kein Random-Token im local-part. - // Vor Fix: Score 0 → PASS. - // Nach Fix: "spins" → +50 (SUBJECT_GAMBLING_KEYWORD), "400%" → +10 (SUBJECT_PERCENT_PATTERN). - // Score = 60 >= SCORE_BLOCK_MIDRANGE (50) → BLOCK. + // "spins" → +50 (SUBJECT_GAMBLING_KEYWORD), "400%" → +15 (SUBJECT_PERCENT_PATTERN), + // "400%" extreme-percent → +20. + // Score = 50 + 15 + 20 = 85 >= SCORE_BLOCK_MIDRANGE (80) → BLOCK. const result = await classifyMail({ mail: { senderEmail: "xpslyjzbt6630@hotmail.com", @@ -554,7 +554,7 @@ describe("classifyMail() — End-to-End Pipeline", () => { }); it("FP-Guard: '10% Rabatt auf deine Bestellung' ohne Gambling-Keyword → PASS", async () => { - // Prozent-Pattern allein: +10 Punkte < SCORE_PASS_BELOW (25) → triggerSource 'no-signal' → PASS. + // Prozent-Pattern allein: +15 Punkte < SCORE_PASS_BELOW (25) → triggerSource 'no-signal' → PASS. // Sicherstellt dass legitime Rabatt-Mails nicht durch das %-Pattern geblockt werden. const result = await classifyMail({ mail: { @@ -588,8 +588,9 @@ describe("classifyMail() — End-to-End Pipeline", () => { // ─── v1.0: Display-Name-only Signale → kein Score-Beitrag ──────────────── it("v1.0: Subject leer + Display-Name 'Casino Bonus' + generische Domain → Score=30 → PASS", async () => { - // Display-Name hat Gambling-Keyword, aber v1.0 wertet das nicht aus. - // Kein Subject-Keyword, keine Gambling-Domain → Score=0 → PASS. + // Display-Name enthält Gambling-Keyword "casino" → +30 (DISPLAY_NAME_GAMBLING_KEYWORD). + // Kein Subject-Keyword, keine Gambling-Domain → Score=30. + // 30 < SCORE_BLOCK_MIDRANGE (40) → PASS. const result = await classifyMail({ mail: { senderEmail: "info@example.com", @@ -606,7 +607,8 @@ describe("classifyMail() — End-to-End Pipeline", () => { it("v1.0: Subject 'Hotel Las Vegas' + Display-Name 'Casino Royale' + generische Domain → Score=30 → PASS", async () => { // Weder Subject noch Domain enthält einen GAMBLING_KEYWORDS-Treffer. - // Display-Name "Casino Royale" hat zwar 'casino', zählt aber v1.0 nicht. + // Display-Name "Casino Royale" enthält 'casino' → +30 (DISPLAY_NAME_GAMBLING_KEYWORD), + // keywordHitsName.length = 1. const result = await classifyMail({ mail: { senderEmail: "info@hotel-example.com", diff --git a/backend/tests/voice/quota.test.ts b/backend/tests/voice/quota.test.ts index 9fe0a49..ed5eb53 100644 --- a/backend/tests/voice/quota.test.ts +++ b/backend/tests/voice/quota.test.ts @@ -2,8 +2,8 @@ * Tests for voice quota DB layer (server/db/voiceQuota.ts). * * Covers: - * - Free: partial consumption → correct remaining - * - Free: exhausted quota → 0 remaining + * - Pro: partial consumption → correct remaining + * - Pro: exhausted quota → 0 remaining * - Day-rollover: stale resetAt → auto-reset to plan default * - Legend: unlimited → consumeVoiceQuota is a no-op * - estimateAudioSeconds: basic sanity @@ -74,7 +74,7 @@ describe("getRemainingVoiceQuota — pro plan (300s)", () => { expect(mocks.profile.update).not.toHaveBeenCalled(); }); - it("returns 0 when full 60s consumed", async () => { + it("returns 0 when full 300s consumed", async () => { const todayMidnight = new Date(); todayMidnight.setUTCHours(0, 0, 0, 0); @@ -108,7 +108,7 @@ describe("getRemainingVoiceQuota — day rollover", () => { yesterday.setUTCHours(0, 0, 0, 0); mocks.profile.findUnique.mockResolvedValueOnce({ - voiceSecondsUsedToday: 60, // was fully consumed yesterday + voiceSecondsUsedToday: 60, // consumed 60s yesterday voiceQuotaResetAt: yesterday, });