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

# MockFetchOptions

Options of [createMockFetch](../functions/createMockFetch.md).

## Properties

### routes?

> `optional` **routes?**: `Record`<`string`, [`MockHandler`](../type-aliases/MockHandler.md)>

Overrides or adds routes by `"METHOD /api/v1/path"`. A `:name` segment matches
any value, which arrives in `req.params.name` (e.g. `'GET /api/v1/deposits/:depositId'`). An exact
route wins over one with parameters; between equals, a handler here wins over the default. Routes without a
handler (default or here) return `404 NOT_FOUND`.

#### Example

```ts
createMockFetch({ routes: { 'GET /api/v1/config': () => fail(503, 'UNAVAILABLE') } })
```

***

### twoFactorRequired?

> `optional` **twoFactorRequired?**: `boolean`

Simulates an account with 2FA enabled: `POST /auth/login` without `twoFactorCode` returns
`{ status: '2fa_required' }`; with any non-empty code, it authenticates normally.
Default: `false`.

***

### user?

> `optional` **user?**: `object`

Simulated identity used in the access token claims and in `auth` responses.

#### operatorId?

> `optional` **operatorId?**: `string`

Operator id. Default: `'mock-operator-1'`.

#### userId?

> `optional` **userId?**: `string`

User id. Default: `'mock-user-1'`.

***

### withdrawalOtp?

> `optional` **withdrawalOtp?**: `boolean`

Simulates an operator that requires an OTP on withdrawal (`withdraw_money` flow in `config.otp.flows`):
`withdrawals.request` returns `{ status: 'otp_required' }` and `withdrawals.confirmOtp` with
any non-empty code submits the withdrawal. Default: `false` (withdrawal created immediately).
