Add recent outreach rejections stream

This commit is contained in:
jjbrunton committed 2026-08-14 15:45:57 +01:00
1 parent 0c21202253
commit 94049ed9c4
9 files changed
+170 -16

No files matched your search

+15
View File
@@ -245,6 +245,21 @@ describe('CandidateQueueRepository', () => {
expect(reasons).toEqual([{ last_error: 'Cleared manually by operator' }]);
});
it('lists the latest 50 rejected candidates by their terminal update time', () => {
queue.enqueue([post('older', 'alice'), post('newer', 'bob')], 'image', 1, 1_000);
const older = queue.claimForScreening('older-worker', 1_000, 1_001)!;
queue.reject(older.postId, 'older-worker', 'No gender tag in title/body', 1_002);
const newer = queue.claimForScreening('newer-worker', 1_000, 1_003)!;
queue.reject(newer.postId, 'newer-worker', 'Seller signals detected', 1_004);
queue.enqueue([post('manual', 'carol')], 'image', 1, 1_005);
queue.cancelUnsent('manual', 1_006);
expect(queue.listRecentRejected()).toEqual([
expect.objectContaining({ postId: 'newer', lastError: 'Seller signals detected', updatedAt: 1_004 }),
expect.objectContaining({ postId: 'older', lastError: 'No gender tag in title/body', updatedAt: 1_002 }),
]);
});
it('edits only prepared unsent messages and clears generated attribution', () => {
queue.enqueue([post('editable', 'alice', 200), post('waiting', 'bob', 100)], 'image', 1, 1_000);
const editable = queue.claimForScreening('screen', 1_000, 1_001)!;