# `ExGAM.Ledger.Store.Mock`
[🔗](https://github.com/elchemista/ex_gam/blob/0.1.0/lib/ex_gam/ledger/store/mock.ex#L1)

Deterministic test adapter which wraps a real ledger Store.

The mock never reimplements ledger semantics. Unscripted calls are delegated
to the configured Store, while scripted calls can replace a reply before the
delegate runs or after it has run. The latter is useful for simulating a lost
acknowledgement after a durable commit.

Scripts contain `{operation, phase, reply}` tuples. Supported operations are
`:append`, `:load`, `:lookup_batch`, and `:export`; phases are `:before` and
`:after`. Append scripts cannot synthesize a successful commit, and an
after-append reply is used only when the delegate really succeeded. Each
operation consumes its own script in insertion order.

# `action`

```elixir
@type action() :: {atom(), :before | :after, term()}
```

# `calls`

```elixir
@spec calls(GenServer.server()) :: [map()]
```

Returns delegated calls in execution order.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `push`

```elixir
@spec push(GenServer.server(), action() | [action()]) :: :ok | {:error, term()}
```

Appends validated fault actions to the running script.

# `start_link`

```elixir
@spec start_link(keyword()) :: GenServer.on_start()
```

Starts a mock around the required `:store` adapter configuration.

---

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