Fix commenter-targeted outreach attribution

This commit is contained in:
jjbrunton committed 2026-08-14 12:45:16 +01:00
1 parent b5304e24e3
commit f77157d303
19 files changed
+328 -49

No files matched your search

+11 -4
View File
@@ -36,6 +36,7 @@ function createMockAiClient(
detectGenderOnly: vi.fn(async () => gender),
analyzeImage: vi.fn(async () => analysis),
generateMessage: vi.fn(async () => message),
generateCommentTargetedMessage: vi.fn(async () => message),
generateReply: vi.fn(async () => 'Reply'),
detectUpsell: vi.fn(() => ({ isUpsell: false })),
analyzeAndGenerateMessage: vi.fn(async (base64: string, mimeType: string, title: string, author: string, examples?: string[], strategyPrompt?: string, postFlair?: string | null, toneGuidance?: string) => {
@@ -114,10 +115,16 @@ describe('ProcessorService', () => {
},
});
expect(aiClient.generateMessage).toHaveBeenCalledWith(
'Beautiful woman', 'Test Post', 'commenter', [], undefined, null, undefined, undefined, [],
expect.stringContaining("I'd love that to be done to me"),
);
expect(aiClient.generateCommentTargetedMessage).toHaveBeenCalledWith({
recipient: 'commenter',
comment: "I'd love that to be done to me",
sourcePostTitle: 'Test Post',
sourceImageAnalysis: 'Beautiful woman',
strategyGuidance: undefined,
toneGuidance: undefined,
recentMessages: [],
});
expect(aiClient.generateMessage).not.toHaveBeenCalled();
});
it('returns null when no image URL', async () => {