Coffrify.Testing.Fixtures (Coffrify v0.9.0)

View Source

Minimal but realistic response fixtures for tests. All builders accept a map of overrides that is shallow-merged into the default.

Summary

Functions

Build an API-key fixture (without the secret value).

Build a transfer fixture.

Build a webhook fixture.

Build a Coffrify webhook event envelope.

Build a Standard Webhooks-style header set for a given event id and ts.

Functions

api_key(overrides \\ %{})

@spec api_key(map()) :: map()

Build an API-key fixture (without the secret value).

transfer(overrides \\ %{})

@spec transfer(map()) :: map()

Build a transfer fixture.

webhook(overrides \\ %{})

@spec webhook(map()) :: map()

Build a webhook fixture.

webhook_event(type, data \\ %{})

@spec webhook_event(String.t(), map()) :: map()

Build a Coffrify webhook event envelope.

Example

event = Coffrify.Testing.Fixtures.webhook_event("transfer.created", %{
  "transfer" => Coffrify.Testing.Fixtures.transfer()
})

webhook_headers(event_id, timestamp, signature)

@spec webhook_headers(String.t(), String.t() | integer(), String.t()) :: [
  {String.t(), String.t()}
]

Build a Standard Webhooks-style header set for a given event id and ts.