# Tests and fakes

In `jadpo test`, every package has a generated fake, so tests never call
a provider. An operation answers with a valid default built from its
output type. A test scripts a response or a failure for one call with
`fakes:` ([Fakes for integrations](fakes-for-integrations.md)),
and the test host puts one fake in every provider connection's place,
answering each operation's scripted answers in order:

```jadpo
test "a taken slot is reported" {
    fakes: {
        couriers.bookings.create: [slot_taken]
    }
    ...
}
```

Responses still pass through the real retries, decoding and mapping, and
package actions run for real over the faked operations.

The compiler checks every scripted response against the package's types,
so a fake can't return a shape the provider never would. Tests script the
clean type, never the shape on the wire. Fakes keep idempotency keys as
the provider does, and accept `lost` and `in_use` as scripted answers
([Several changing calls in one action](several-changing-provider-calls.md)).
Grants are declared as fixtures.

`jadpo test --kind contract` runs the same cases against the provider's
sandbox, in CI on a schedule. Every written operation that isn't
confirmed by a recording must have a case in that run.

> Grants as fixtures and the contract run aren't built yet.
