You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Invalid fixtures (including empty `{}` when the schema defines properties) respond 500.
23
22
24
23
Types
25
-
- Fixtures default to strict types. Generated modules import response types from `@api/types.gen` and use a `satisfies` clause to ensure compatibility.
24
+
- Fixtures use strict types via the `AutoAPIMock` wrapper. Generated modules import response types from `@api/types.gen` and pass them as generic parameters to `AutoAPIMock<T>` for type safety.
26
25
- Make sure `tsconfig.json` includes: `"paths": { "@api/*": ["./src/generated/*"] }`.
26
+
27
+
## Test-Scoped Overrides with AutoAPIMock
28
+
29
+
Each fixture is wrapped in `AutoAPIMock<T>`, which provides test-scoped override capabilities.
30
+
31
+
### Fixture Structure
32
+
33
+
Generated fixtures use named exports with a consistent naming convention:
Use `activateMockScenario` to activate a scenario across all registered mocks at once. This is useful for setting up a consistent state across multiple endpoints, with the option to further customize individual mocks afterwards.
Scenario names are defined in `src/mocks/scenarioNames.ts` via the `MockScenarios` object, which provides autocomplete and JSDoc documentation. Global scenarios are automatically reset before each test via `resetAllAutoAPIMocks()` in the test setup.
0 commit comments