This version (v0.7) has not been published to npm yet.
Skip to content

Reference / @getenginex/sdk-igaming/testing / withIgamingRoutes

withIgamingRoutes() ​

withIgamingRoutes(options?): MockFetchOptions

Adds the iGaming mock routes (createIgamingRoutes) 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 = {}

The options you would pass to createMockFetch.

Returns ​

MockFetchOptions

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)