-
Notifications
You must be signed in to change notification settings - Fork 0
refactor: define interfaces for Google API clients to enable unit testing #35
Copy link
Copy link
Closed
Description
Summary
Critical testability blocker. Direct dependency on concrete Google API types makes unit testing impossible. All command tests require real API credentials.
Current State
gmail.Client.Serviceis*gmail.Service(concrete)calendar.Client.Serviceis*calendar.Service(concrete)contacts.Client.Serviceis*people.Service(concrete)- No way to inject mocks
Files:
internal/gmail/client.go:28-32internal/calendar/client.go:25-26internal/contacts/client.go:22-23
Problems
- Cannot swap implementations (mock, different versions)
- Cannot add caching, rate limiting, or circuit breakers without touching all call sites
- Tests require real Google services
Proposed Solution
Define interfaces for each service:
type GmailService interface {
GetMessage(userID, messageID string) (*Message, error)
SearchMessages(userID, query string, maxResults int64) ([]*Message, error)
GetThread(userID, threadID string) (*Thread, error)
// ...
}Make Service field private, expose only through interface.
Priority
P0 - Critical for testability
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels