Add manual outreach funnel clearing
This commit is contained in:
1 parent
6b2e1bc380
commit
4798385d8b
16 files changed
+319
-17
No files matched your search
@@ -172,6 +172,44 @@ describe('dashboard foundation', () => {
|
||||
expect(sourceImage).not.toHaveClass('is-blurred');
|
||||
});
|
||||
|
||||
it('requires confirmation before clearing unsent outreach and preserves in-flight sends', async () => {
|
||||
installSuccessfulApi();
|
||||
let cleared = false;
|
||||
let deleteRequests = 0;
|
||||
server.use(
|
||||
http.get('/api/outreach', () => HttpResponse.json({
|
||||
generatedAt: Date.now(),
|
||||
activeCount: cleared ? 1 : 3,
|
||||
stages: { discovered: cleared ? 0 : 2, screening: 0, ready: 0, sending: 1, retryable: 0 },
|
||||
outcomes: { sent: 12, rejected: cleared ? 9 : 7 },
|
||||
oldestActiveAt: Date.now() - 60_000,
|
||||
candidates: [],
|
||||
})),
|
||||
http.delete('/api/outreach', () => {
|
||||
deleteRequests += 1;
|
||||
cleared = true;
|
||||
return HttpResponse.json({
|
||||
success: true,
|
||||
cleared: { discovered: 2, screening: 0, ready: 0, retryable: 0, total: 2 },
|
||||
retainedSending: 1,
|
||||
});
|
||||
}),
|
||||
);
|
||||
renderDashboard('/outreach');
|
||||
const user = userEvent.setup();
|
||||
|
||||
await user.click(await screen.findByRole('button', { name: 'Clear funnel' }));
|
||||
const dialog = screen.getByRole('dialog', { name: 'Clear the outreach funnel?' });
|
||||
expect(dialog).toHaveTextContent('cancel 2 waiting, screening, prepared, or retrying candidates');
|
||||
expect(dialog).toHaveTextContent('1 in-flight send will be left alone');
|
||||
expect(deleteRequests).toBe(0);
|
||||
|
||||
await user.click(within(dialog).getByRole('button', { name: 'Clear funnel' }));
|
||||
expect(await screen.findByRole('status')).toHaveTextContent('Cleared 2 unsent candidates. 1 in-flight send was retained.');
|
||||
await waitFor(() => expect(screen.getByRole('heading', { name: '1 active post' })).toBeInTheDocument());
|
||||
expect(deleteRequests).toBe(1);
|
||||
});
|
||||
|
||||
it('hydrates media filters from the routed URL', async () => {
|
||||
installSuccessfulApi();
|
||||
server.use(
|
||||
|
||||
Reference in new issue
Block a user