Integrate local business workflow and SaaS redesign

This commit is contained in:
2026-06-12 21:08:35 +02:00
parent f00c5a3193
commit 21c7e4c9a4
88 changed files with 2683 additions and 849 deletions

View File

@@ -211,6 +211,7 @@ test("duplicate detection uses placeId and websiteDomain", () => {
const existingLeads = [
{
googlePlaceId: "dup-1",
sourceBusinessId: "business-dup-1",
websiteDomain: "other.de",
email: "blocked@example.de",
},
@@ -233,6 +234,31 @@ test("duplicate detection uses placeId and websiteDomain", () => {
googlePrimaryType: null,
googleMapsUrl: null,
sourceProvider: "google_places",
sourceBusinessId: "business-other",
sourceFetchedAt: 0,
},
existingLeads,
),
true,
);
assert.equal(
isDuplicateCandidate(
{
placeId: "none",
businessName: "Test",
address: "A",
websiteUrl: null,
websiteDomain: null,
phone: null,
rating: null,
userRatingCount: null,
businessStatus: null,
googleTypes: [],
googlePrimaryType: null,
googleMapsUrl: null,
sourceProvider: "local_business_data",
sourceBusinessId: "business-dup-1",
sourceFetchedAt: 0,
},
existingLeads,
@@ -439,9 +465,10 @@ test("probable duplicates are detected by normalized company+address or normaliz
);
});
test("blacklist matches include google_place_id, domain, company and phone", () => {
test("blacklist matches include source ids, domain, company and phone", () => {
const candidate = {
placeId: "place-blacklisted",
sourceBusinessId: "business-blacklisted",
businessName: "Muster GmbH",
address: "A",
websiteUrl: "https://www.Blocked.de",
@@ -461,6 +488,7 @@ test("blacklist matches include google_place_id, domain, company and phone", ()
assert.deepEqual(getBlacklistLookupValues(candidate), [
{ type: "google_place_id", normalizedValue: "place-blacklisted" },
{ type: "source_business_id", normalizedValue: "business-blacklisted" },
{ type: "domain", normalizedValue: "blocked.de" },
{ type: "company", normalizedValue: "muster gmbh" },
{ type: "phone", normalizedValue: "4930555123" },
@@ -477,6 +505,11 @@ test("blacklist matches include google_place_id, domain, company and phone", ()
value: "place-blacklisted",
normalizedValue: "place-blacklisted",
},
{
type: "source_business_id",
value: "business-blacklisted",
normalizedValue: "business-blacklisted",
},
{ type: "domain", value: "blocked.de", normalizedValue: "blocked.de" },
{ type: "company", value: "Muster GmbH", normalizedValue: "muster gmbh" },
{ type: "phone", value: "+49 30 555 123", normalizedValue: "4930555123" },
@@ -498,7 +531,15 @@ test("blacklist matches include google_place_id, domain, company and phone", ()
const matchTypes = matches.map((match) => match.type).sort();
assert.deepEqual(
matchTypes,
["company", "domain", "google_place_id", "phone", "phone", "email"].sort(),
[
"company",
"domain",
"google_place_id",
"source_business_id",
"phone",
"phone",
"email",
].sort(),
);
});
@@ -522,6 +563,7 @@ test("company normalization for blacklist lookup uses text normalization", () =>
assert.deepEqual(getBlacklistLookupValues(candidate), [
{ type: "google_place_id", normalizedValue: "place-company-spaces" },
{ type: "source_business_id", normalizedValue: "place-company-spaces" },
{ type: "company", normalizedValue: "muster gmbh" },
{ type: "phone", normalizedValue: "4930555123" },
{ type: "phone", normalizedValue: "+49 30 555 123" },