Skip to main content

createFakeServices

Builds a complete Services from the fakes.

This is a function exported by @mapcairn/core, checked against version 0.2.0.

Signature​

import { createFakeServices } from "@mapcairn/core";

function createFakeServices(overrides?: Partial<Services>): FakeServices;

Description​

How to script it: script the objects under fakes (for example fakes.search.setDefaultResults(...)). To replace a part, pass it in overrides; the returned service then uses your object, and the matching entry in fakes is left unused.

The default createMapAdapter is createFakeMapAdapterFactory, and each adapter it builds is recorded in fakes.maps.

routing, fileOpener, suggestions, selection and featureQuery are optional on Services, but the fakes include them so a test can script routes, files, suggestions, a selected set and the features inside a shape. To test the ui without one, pass it as undefined, for example { routing: undefined }.

Parameters​

  • overrides? (Partial<Services>)

Returns​

FakeServices

See also​

Source: packages/core/src/fakes/createFakeServices.ts:86