Accrue.Test.Clock (accrue v0.3.0)

Copy Markdown View Source

Deterministic clock helpers for host tests.

The helper drives Accrue.Processor.Fake directly and never sleeps.

Summary

Functions

Advances the Fake test clock by a readable, keyword, or integer duration.

Types

duration()

@type duration() ::
  binary()
  | integer()
  | [
      months: integer(),
      days: integer(),
      hours: integer(),
      minutes: integer(),
      seconds: integer()
    ]

Functions

advance(subject, duration)

@spec advance(term(), duration()) :: {:ok, term()} | {:error, term()}

Advances the Fake test clock by a readable, keyword, or integer duration.

If subject carries a processor_id or stripe_id, the subscription-aware Fake clock API is used so trial and renewal lifecycle effects can fire.