# `Periodic.Test`
[🔗](https://github.com/sasa1977/parent/blob/0.13.0/lib/periodic/test.ex#L1)

Helpers for testing a periodic job.

See the "Testing" section in `Periodic` documentation for details.

# `assert_periodic_event`
*macro* 

Waits for the given telemetry event.

# `observe`

```elixir
@spec observe(any()) :: :ok
```

Subscribes to telemetry events of the given scheduler.

# `refute_periodic_event`
*macro* 

Asserts that the given telemetry event won't be emitted.

# `sync_tick`

```elixir
@spec sync_tick(GenServer.server(), non_neg_integer() | :infinity) ::
  {:ok, job_exit_reason :: any()}
  | {:error, :job_not_started | :not_in_manual_mode}
```

Sends a tick signal to the given scheduler and waits for the job to finish.

The function returns the job exit reason, or error if the job hasn't been started.

If the scheduler was not started with `:mode` set to `:manual`, this function returns
`{:error, :not_in_manual_mode}`.

# `tick`

```elixir
@spec tick(GenServer.server()) :: :ok | {:error, :not_in_manual_mode}
```

Sends a tick signal to the given scheduler.

This function returns after the tick signal has been sent, and the job has been started.
However, the function doesn't wait for the job to finish. If you want complete synchronism, use
`sync_tick/2`.

If the scheduler was not started with `:mode` set to `:manual`, this function returns
`{:error, :not_in_manual_mode}`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
