feat(crm): merge company slogan variants in dedupe grouping

Treat names like "Affirm" and "Affirm — Fraud Engineering" as the same
company for dedupe, deal matching, members, and applications sync lookup.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-24 12:40:27 +01:00
co-authored by Cursor
parent c77519fac5
commit 3eb649c58b
7 changed files with 109 additions and 9 deletions
+31
View File
@@ -42,6 +42,37 @@ func TestFixDealTitle(t *testing.T) {
}
}
func TestStripSloganSuffix(t *testing.T) {
tests := []struct {
in, want string
}{
{"Affirm — Fraud Engineering", "Affirm"},
{"Affirm - Fraud Engineering", "Affirm"},
{"Affirm – Fraud Engineering", "Affirm"},
{"Affirm", "Affirm"},
{"— leading", "— leading"},
}
for _, tc := range tests {
if got := StripSloganSuffix(tc.in); got != tc.want {
t.Errorf("StripSloganSuffix(%q) = %q, want %q", tc.in, got, tc.want)
}
}
}
func TestCompanyGroupingKey(t *testing.T) {
a := CompanyGroupingKey("Affirm")
b := CompanyGroupingKey("Affirm — Fraud Engineering")
if a != b {
t.Fatalf("%q != %q", a, b)
}
}
func TestOpportunityTitlesMatchSlogan(t *testing.T) {
if !OpportunityTitlesMatch("Dev @ Affirm — Fraud Engineering", "Dev @ Affirm") {
t.Fatal("expected match")
}
}
func TestStripCompanySuffix(t *testing.T) {
if got := StripCompanySuffix("Dev @ Acme"); got != "Dev" {
t.Fatalf("got %q", got)