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

# withIgamingRoutes()

> **withIgamingRoutes**(`options?`): [`MockFetchOptions`](../../../sdk/testing/interfaces/MockFetchOptions.md)

Adds the iGaming mock routes ([createIgamingRoutes](createIgamingRoutes.md)) to the options of `createMockFetch` from
`@getenginex/sdk/testing`. The core routes still apply; the ones in `options.routes` win over the
iGaming ones (to simulate errors). The other options (`twoFactorRequired`, `withdrawalOtp`, `user`)
pass through as they are, and `options` is not changed.

## Parameters

### options?

[`MockFetchOptions`](../../../sdk/testing/interfaces/MockFetchOptions.md) = `{}`

The options you would pass to `createMockFetch`.

## Returns

[`MockFetchOptions`](../../../sdk/testing/interfaces/MockFetchOptions.md)

## Example

```ts
import { createEnginexClient } from '@getenginex/sdk'
import { createMockFetch, fail } from '@getenginex/sdk/testing'
import { createIgaming } from '@getenginex/sdk-igaming'
import { withIgamingRoutes } from '@getenginex/sdk-igaming/testing'

const enginex = createEnginexClient({
  baseUrl: 'https://gateway.test', // in Node: absolute baseUrl + tenantHost (optional in the browser)
  tenantHost: 'casino.test',
  fetch: createMockFetch(
    withIgamingRoutes({ routes: { 'GET /api/v1/games': () => fail(503, 'UNAVAILABLE') } }),
  ),
})
const igaming = createIgaming(enginex)
```
