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
Context
After consolidating the three contact tables into
fulfil_contacts(#51, #52), the only test coverage is inActiveCustomersControllerTestwhich covers the API/controller layer. The core business logic has no tests.Missing coverage
FulfilContact model
broker(),discovered(),uncategorized(),fromFulfil())findOrCreateForContact()— idempotent create behaviorrecordEmailSent()/recordEmailReceived()— only updates when date is newergetFulfilName()/parseFulfilName()— broker name formattingGmailService
buildBrokerEmailMap— aggregating broker emails across prospects and customersProspectController
fulfil_contactsLocalCustomerMetadata
contacts()andbrokerContacts()relationshipshasBrokerData()using the consolidated relationship