Problem
Three of the six job routines in packages/entrypoints/src/jobs/ have no unit tests:
ServerCleanupRoutine.ts — no test file
PendingServerCleanupRoutine.ts — no test file
TerminateLongRunningServerRoutine.ts — no test file
The other three routines (ConsumeCreditsRoutine, TerminateServersWithoutCreditRoutine, MonthlyUsageReportRoutine) all have test files.
Fix
Add test files for each missing routine. Each should:
- Use the
makeSut pattern (no shared state)
- Follow Given/When/Then structure
- Mock
node-schedule with vi.mock("node-schedule") (see ConsumeCreditsRoutine.test.ts for reference)
- Verify the job is scheduled with the correct cron expression
- Verify the use case is called when the job fires
- Verify errors are caught, logged via
logger, and reported via eventLogger
Expected cron expressions to test:
ServerCleanupRoutine: '* * * * *'
PendingServerCleanupRoutine: '*/15 * * * *'
TerminateLongRunningServerRoutine: '*/30 * * * *'
Problem
Three of the six job routines in
packages/entrypoints/src/jobs/have no unit tests:ServerCleanupRoutine.ts— no test filePendingServerCleanupRoutine.ts— no test fileTerminateLongRunningServerRoutine.ts— no test fileThe other three routines (
ConsumeCreditsRoutine,TerminateServersWithoutCreditRoutine,MonthlyUsageReportRoutine) all have test files.Fix
Add test files for each missing routine. Each should:
makeSutpattern (no shared state)node-schedulewithvi.mock("node-schedule")(seeConsumeCreditsRoutine.test.tsfor reference)logger, and reported viaeventLoggerExpected cron expressions to test:
ServerCleanupRoutine:'* * * * *'PendingServerCleanupRoutine:'*/15 * * * *'TerminateLongRunningServerRoutine:'*/30 * * * *'