SCRAPE-10: Implement recordScraperRun() for scraper_runs #15
Reference in New Issue
Block a user
No description provided.
Delete Branch "scraper/record-run"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Test Coverage
17 tests covering:
Test Plan
❌ Changes Requested
recordScraperRun() uses console.error instead of the structured logger pattern used by every other function in scraperService.js. It should accept a logger parameter to match upsertUnits, insertPrices, markStaleUnits, and updateDailySummary.
Issues:
services/scraperService.js:634
Pattern inconsistency: every other db-accessing function in this file accepts a
loggerparameter and useslogger.error()/logger.info()for output. This function should follow the same pattern:async function recordScraperRun(db, runData, logger)and uselogger.error('Failed to record scraper run', { errorMessage: error.message })instead ofconsole.error.tests/scraper/recordScraperRun.test.js:186
Update test to pass a mock logger and assert
logger.error()is called instead of spying onconsole.error. This aligns with how other test suites in this project verify logging behavior.