starbasedb
starbasedb copied to clipboard
test: cover cron plugin behavior
Summary
Adds focused Vitest coverage for the cron plugin slice of #71.
This covers:
- plugin metadata and auth requirement
- next execution time calculation
- addEvent rejection before initialization
- middleware table initialization with no empty-task alarm scheduling
- nearest-task activation and
setAlarmscheduling - event insertion and alarm rescheduling
/cron/callbackpayload dispatch- async
onEventhandlers being passed intoctx.waitUntil
Bounty
Contributes to Algora bounty issue #71.
Verification
COREPACK_ENABLE_PROJECT_SPEC=0 corepack pnpm vitest plugins/cron/index.test.ts --runCOREPACK_ENABLE_PROJECT_SPEC=0 corepack pnpm exec prettier --check plugins/cron/index.test.tsgit diff --checkCOREPACK_ENABLE_PROJECT_SPEC=0 corepack pnpm exec tsc --noEmit --pretty false 2>&1 | tee /tmp/starbasedb-cron-tsc.log; ! rg -n "plugins/cron" /tmp/starbasedb-cron-tsc.log
Full-suite note:
COREPACK_ENABLE_PROJECT_SPEC=0 corepack pnpm vitest --runstill reports the existing 4 RLS failures insrc/rls/index.test.ts; the new cron test file passes in that run.