feat: persist settings and enrich conversation context
This commit is contained in:
1 parent
a36723a325
commit
2c100d72b6
84 files changed
+2248
-644
No files matched your search
@@ -161,6 +161,39 @@ describe('ResponseCheckerService', () => {
|
||||
expect(messagesRepo.markChecked).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('does not track an unassociated reply as performance', async () => {
|
||||
const message: SentMessageRecord = {
|
||||
id: 1,
|
||||
postId: null,
|
||||
recipient: 'user1',
|
||||
subject: 'Hello',
|
||||
message: 'Hey!',
|
||||
sentAt: Date.now() - 2 * 3600000,
|
||||
gotResponse: false,
|
||||
responseCheckedAt: null,
|
||||
strategyId: null,
|
||||
chatRoomId: '!room:reddit.com',
|
||||
};
|
||||
messagesRepo = createMockMessagesRepo([message]);
|
||||
checker = new ResponseCheckerService(page, messagesRepo, successfulMessagesRepo, postsRepo, logger);
|
||||
const mockItem = {
|
||||
$: vi.fn(async (selector: string) => selector.includes('author') || selector.includes('sender')
|
||||
? { textContent: vi.fn(async () => 'user1') }
|
||||
: { textContent: vi.fn(async () => 'Hi there') }),
|
||||
evaluate: vi.fn(async () => true),
|
||||
};
|
||||
vi.mocked(page.$$).mockResolvedValue([mockItem as any]);
|
||||
|
||||
const results = await checker.checkForResponses();
|
||||
|
||||
expect(results).toEqual([
|
||||
expect.objectContaining({ messageId: 1, gotResponse: true }),
|
||||
]);
|
||||
expect(messagesRepo.markGotResponse).not.toHaveBeenCalled();
|
||||
expect(messagesRepo.markChecked).toHaveBeenCalledWith(1);
|
||||
expect(successfulMessagesRepo.insert).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('stores successful messages for learning', async () => {
|
||||
const post: ProcessedPostRecord = {
|
||||
id: 'post1',
|
||||
|
||||
Reference in new issue
Block a user