createTestTimer function

WorkflowTimer createTestTimer(
  1. String timerId,
  2. String executionId, {
  3. String stepName = 'timer-step',
  4. String? fireAt,
  5. TimerStatus status = TimerStatus.pending,
})

Creates a WorkflowTimer with sensible defaults for testing.

Implementation

WorkflowTimer createTestTimer(
  String timerId,
  String executionId, {
  String stepName = 'timer-step',
  String? fireAt,
  TimerStatus status = TimerStatus.pending,
}) {
  final now = nowTimestamp();
  return WorkflowTimer(
    workflowTimerId: timerId,
    workflowExecutionId: executionId,
    stepName: stepName,
    fireAt: fireAt ?? pastTimestamp(ago: const Duration(minutes: 1)),
    status: status,
    createdAt: now,
  );
}