feat: track received image outcomes
This commit is contained in:
1 parent
50de1c180d
commit
d819a0f1e6
15 files changed
+145
-21
No files matched your search
@@ -199,10 +199,12 @@ describe('MessagesRepository', () => {
|
||||
expect(row!.chatRoomId).toBe('!room123:reddit.com');
|
||||
expect(row!.recipient).toBe('alice');
|
||||
expect(row!.gotResponse).toBe(false);
|
||||
expect(row!.gotImage).toBe(false);
|
||||
|
||||
messagesRepo.markGotResponse(id);
|
||||
messagesRepo.markGotImage(id);
|
||||
const updated = messagesRepo.getByChatRoomId('!room123:reddit.com');
|
||||
expect(updated!.gotResponse).toBe(true);
|
||||
expect(updated!.gotImage).toBe(true);
|
||||
});
|
||||
|
||||
it('keeps unassociated chat history out of performance trends', () => {
|
||||
@@ -353,6 +355,7 @@ describe('MessagesRepository', () => {
|
||||
|
||||
messagesRepo.markGotResponse(1);
|
||||
messagesRepo.markGotResponse(3);
|
||||
messagesRepo.markGotImage(1);
|
||||
|
||||
const stats = messagesRepo.getStrategyStats();
|
||||
expect(stats.length).toBe(2);
|
||||
@@ -361,11 +364,15 @@ describe('MessagesRepository', () => {
|
||||
expect(variantA!.totalSent).toBe(2);
|
||||
expect(variantA!.totalResponses).toBe(1);
|
||||
expect(variantA!.responseRate).toBe(50);
|
||||
expect(variantA!.totalImages).toBe(1);
|
||||
expect(variantA!.imageRate).toBe(50);
|
||||
|
||||
const variantB = stats.find(s => s.strategyId === 'variant-b');
|
||||
expect(variantB!.totalSent).toBe(1);
|
||||
expect(variantB!.totalResponses).toBe(1);
|
||||
expect(variantB!.responseRate).toBe(100);
|
||||
expect(variantB!.totalImages).toBe(0);
|
||||
expect(variantB!.imageRate).toBe(0);
|
||||
});
|
||||
|
||||
it('excludes messages without strategy_id from stats', () => {
|
||||
|
||||
Reference in new issue
Block a user