The uuid v13 package is ESM-only, which causes Jest to fail when
loading routes/admin.js -> jobs/scraperJob.js -> uuid without mocks.
This broke all admin dashboard tests (phase1-4) with silent 404s.
Switched to Node.js built-in crypto.randomUUID() and updated all
test mocks from uuid to crypto accordingly.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Implement the manual scraper trigger endpoint with the following:
- Protected by requireAuth and requireAdmin middleware (401/403)
- Mutex lock check via isScraperRunning to prevent concurrent runs (409)
- Generates UUID jobId for tracking async scrape execution
- Returns 202 Accepted immediately without blocking on scrape completion
- Releases mutex lock in .finally() to ensure cleanup on success or failure
- Logs ADMIN_TRIGGER_SCRAPE activity with jobId, dryRun, and
usingProvidedHtml metadata via activityLogger
- Supports dryRun option (defaults to false) and htmlContent for
testing with pre-fetched HTML
- Passes trigger: 'manual', jobId, dryRun, and htmlContent to runScrape
Includes 20 tests covering auth, mutex, async execution, activity
logging, dryRun/htmlContent options, and response structure.