Skip to content

Test scheduled-post job outcomes with fakes #15

Description

@brudex

Proposed labels: testing, area:backend, help wanted

Context

Scheduled-post cron modules make status, schedule-status, and batch-counter
transitions that are important to publishing reliability. The root test suite
currently concentrates on API contracts and release smoke checks rather than
these job outcome combinations.

Suggested starting points

  • job-runner/schedule-due-posts-cron.js
  • job-runner/publish-scheduled-cron.js
  • job-runner/publish-recurring-cron.js
  • job-runner/lib/publish-post-accounts.js
  • test/

Scope

Add the smallest practical dependency seams and fake models/publishers needed
to cover no-due-post, all-success, partial-success, and total-failure paths.
Assert post status, schedule status, and relevant batch counters for each path.

Non-goals

  • Do not change scheduling or retry policy unless a failing test demonstrates
    an existing defect and the maintainer agrees on the behavior.
  • Do not invoke real providers, cron daemons, or database infrastructure.

Acceptance criteria

  • Tests cover all four outcome classes for the affected scheduled/recurring
    flow.
  • Assertions include final post and schedule status plus batch accounting where
    the module maintains it.
  • The test suite is deterministic and makes no network calls.
  • Production behavior is unchanged unless a separately documented bug fix is
    included with a regression test.

Verification

  1. Run npm test twice to confirm deterministic results.
  2. Confirm all provider/model boundaries in the new tests are faked.
  3. Run git diff --check.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:backendBackend services and APIshelp wantedExtra attention is neededtestingTest coverage and test infrastructure

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions