---
url: >-
  https://game-engine-io.github.io/enginex-frontend-sdk/reference/api/@getenginex/sdk-predictions/testing/functions/createPredictionsRoutes.md
---
[Reference](../../../../index.md) / [@getenginex/sdk-predictions/testing](../index.md) / createPredictionsRoutes

# createPredictionsRoutes()

> **createPredictionsRoutes**(): `Record`<`string`, [`MockHandler`](../../../sdk/testing/type-aliases/MockHandler.md)>

Creates the predictions mock routes, in the `MockFetchOptions.routes` format of `createMockFetch`
from `@getenginex/sdk/testing` (`"METHOD /api/v1/path"` → handler). Each call returns new routes,
with its own in-memory state: create one per mock. Prefer [withPredictionsRoutes](withPredictionsRoutes.md),
which already does the merge with your options.

Covers `markets`: 3 categories, 3 events and 5 fixed markets (`mock-market-1` to `mock-market-5`),
deterministic orderbook and price history (the same id, the same response) and `MARKET_NOT_FOUND`/
`EVENT_NOT_FOUND` with HTTP 500 for unknown ids, like the gateway. Covers `comments`: two
seeded comments on `mock-market-1`, creation (root and reply), like/unlike and listing of
one's own, with in-memory state (the authenticated routes answer 401 without a token). Covers `orders` and
`portfolio`: `POST /orders` returns an `open` order (the `market` one executes immediately and becomes a position), the same
idempotency key returns the same order, the batch places each order on its own (an unknown market fails
that order), and positions and portfolio derive from the orders. All responses
match the SDK schemas, even with `validation: 'strict'`.

## Returns

`Record`<`string`, [`MockHandler`](../../../sdk/testing/type-aliases/MockHandler.md)>

## Example

```ts
import { createMockFetch } from '@getenginex/sdk/testing'
import { createPredictionsRoutes } from '@getenginex/sdk-predictions/testing'

const fetch = createMockFetch({ routes: { ...createPredictionsRoutes(), ...myRoutes } })
```
