import { describe, expect, it } from 'vitest'; import { classifyConversationOutcome } from '../src/services/conversation-outcome.js'; describe('conversation outcome classification', () => { it.each([ ['That sounds fun, tell me more', 'unknown'], ['No thanks, not interested', 'declined'], ['Check my OnlyFans link in bio', 'upsell'], ['Stop messaging me', 'boundary'], ] as const)('classifies %s as %s', (reply, expected) => { expect(classifyConversationOutcome(reply)).toBe(expected); }); it('classifies a reciprocal multi-message conversation as engaged', () => { expect(classifyConversationOutcome('That sounds fun, tell me more', { messageCount: 4, reciprocal: true, learningEligible: true, })).toBe('engaged'); }); it('lets a later refusal override earlier reciprocal engagement', () => { expect(classifyConversationOutcome("I'm good", { messageCount: 8, reciprocal: true, learningEligible: true, mediaWasRequested: true, responses: ['Sure, tell me more', 'Zero interest in sending you anything lol', "I'm good"], })).toBe('declined'); }); it('does not promote a positive reciprocal thread while automation is active', () => { expect(classifyConversationOutcome('Sure, tell me more', { messageCount: 4, reciprocal: true, learningEligible: false, })).toBe('unknown'); }); });