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

Reference / @getenginex/sdk-predictions/testing / withPredictionsRoutes

withPredictionsRoutes() ​

withPredictionsRoutes(options?): MockFetchOptions

Adds the predictions mock routes (createPredictionsRoutes) to the options of createMockFetch from @getenginex/sdk/testing. The core routes still apply; the ones in options.routes win over the predictions 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 } from '@getenginex/sdk/testing'
import { createPredictions } from '@getenginex/sdk-predictions'
import { withPredictionsRoutes } from '@getenginex/sdk-predictions/testing'

const enginex = createEnginexClient({
  baseUrl: 'https://gateway.test', // in Node: absolute baseUrl + tenantHost (optional in the browser)
  tenantHost: 'casino.test',
  fetch: createMockFetch(withPredictionsRoutes()),
})
const predictions = createPredictions(enginex)