starbasedb icon indicating copy to clipboard operation
starbasedb copied to clipboard

test: cover cron plugin behavior

Open Treasure520520 opened this issue 6 months ago • 0 comments

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 setAlarm scheduling
  • event insertion and alarm rescheduling
  • /cron/callback payload dispatch
  • async onEvent handlers being passed into ctx.waitUntil

Bounty

Contributes to Algora bounty issue #71.

Verification

  • COREPACK_ENABLE_PROJECT_SPEC=0 corepack pnpm vitest plugins/cron/index.test.ts --run
  • COREPACK_ENABLE_PROJECT_SPEC=0 corepack pnpm exec prettier --check plugins/cron/index.test.ts
  • git diff --check
  • COREPACK_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 --run still reports the existing 4 RLS failures in src/rls/index.test.ts; the new cron test file passes in that run.

Treasure520520 avatar May 12 '26 20:05 Treasure520520