feat(email): allow dismissing entity suggestions
All checks were successful
Build and Push Docker Images / build-backend (push) Successful in 45s
Build and Push Docker Images / build-frontend (push) Successful in 1m16s
Build and Push Docker Images / build-website (push) Successful in 23s
Build and Push Docker Images / build-central-services-api (push) Successful in 21s
Build and Push Docker Images / build-central-services-admin (push) Successful in 21s
Build and Push Docker Images / build-docs (push) Successful in 1m18s

This commit is contained in:
2026-09-08 09:54:56 +02:00
parent a09f770a63
commit 1890d1d97d
5 changed files with 107 additions and 5 deletions

View File

@@ -1,6 +1,12 @@
import assert from "node:assert/strict"
import test from "node:test"
import { buildSuggestionMail, selectCandidates, validateSuggestions, type EntityCandidate } from "../src/modules/email/email.entity-suggestions"
import {
buildSuggestionMail,
dismissEntitySuggestion,
selectCandidates,
validateSuggestions,
type EntityCandidate,
} from "../src/modules/email/email.entity-suggestions"
const customer: EntityCandidate = { entityType: "customers", entityId: 1, entityName: "Muster GmbH", entityTypeLabel: "Kunde", email: "kontakt@muster.de" }
const project: EntityCandidate = { entityType: "projects", entityId: 1, entityName: "Umbau", entityTypeLabel: "Projekt", number: "P-2026-123" }
@@ -54,3 +60,12 @@ test("recipient and CC headers neither reach the model nor affect candidate rank
assert.equal(ranked[0], customer)
assert.equal(ranked[1], project)
})
test("dismisses only the selected entity suggestion", () => {
const projectSuggestion = { ...suggestion, entityType: "projects" as const, reason: "Projektnummer stimmt überein." }
assert.deepEqual(
dismissEntitySuggestion([suggestion, projectSuggestion], "customers", 1),
[projectSuggestion],
)
assert.deepEqual(dismissEntitySuggestion(null, "customers", 1), [])
})