Skip to content

Add test coverage for FulfilContact and GmailService contact logic #53

@devinsays

Description

@devinsays

Context

After consolidating the three contact tables into fulfil_contacts (#51, #52), the only test coverage is in ActiveCustomersControllerTest which covers the API/controller layer. The core business logic has no tests.

Missing coverage

FulfilContact model

  • Query scopes (broker(), discovered(), uncategorized(), fromFulfil())
  • findOrCreateForContact() — idempotent create behavior
  • recordEmailSent() / recordEmailReceived() — only updates when date is newer
  • getFulfilName() / parseFulfilName() — broker name formatting

GmailService

  • Email tracking updates during sync (outbound vs inbound direction)
  • Contact discovery — creating discovered contacts for new email addresses matching a customer domain
  • Broker email matching and tracking (prospect broker vs customer broker)
  • buildBrokerEmailMap — aggregating broker emails across prospects and customers
  • Deduplication — not creating contacts that already exist

ProspectController

  • Prospect-to-customer conversion — migrating broker and uncategorized contacts to fulfil_contacts

LocalCustomerMetadata

  • contacts() and brokerContacts() relationships
  • hasBrokerData() using the consolidated relationship

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions