feat: replace browser login with imported Reddit sessions
This commit is contained in:
1 parent
2b0545afcf
commit
c483c7b8be
76 files changed
+2048
-2828
No files matched your search
@@ -221,6 +221,26 @@ describe('ResponseCheckerService', () => {
|
||||
expect(insertCall.subreddit).toBe('gonewild');
|
||||
});
|
||||
|
||||
it('does not turn a declined reply into a learning example', async () => {
|
||||
const message: SentMessageRecord = {
|
||||
id: 1, postId: 'post1', recipient: 'user1', subject: 'Hello', message: 'Hey!',
|
||||
sentAt: Date.now() - 2 * 3600000, gotResponse: false, responseCheckedAt: null, strategyId: null,
|
||||
};
|
||||
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 () => 'No thanks, not interested') }),
|
||||
evaluate: vi.fn(async () => true),
|
||||
};
|
||||
vi.mocked(page.$$).mockResolvedValue([mockItem as any]);
|
||||
await checker.checkForResponses();
|
||||
|
||||
expect(messagesRepo.markGotResponse).toHaveBeenCalledWith(1);
|
||||
expect(successfulMessagesRepo.insert).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('handles inbox parsing errors gracefully', async () => {
|
||||
const message: SentMessageRecord = {
|
||||
id: 1,
|
||||
|
||||
Reference in new issue
Block a user