Skip to content

testClient beta ​

Function of @v12-engine/client/testing

ts
export declare function testClient<More extends object = object>(members?: Omit<FakeOf<GameClientApi>, 'view'> & {
    view?: Partial<GameView>;
} & FakeOf<More>): GameClientApi & More;

A client for a test of a part that is handed one (GameClientApi: a game's hook, a setting, a line of the pause menu, the hands, the minimap), with no page and no renderer: a real createUi() model, empty keys whose context it is, a log nobody reads, the page's storage, the given view (visuals empty when not given); the rest as the test gives it (FakeOf), and nothing where it gives none. More is what the part's host takes of GameClient besides (mapPings for the minimap)

ts
// testClient, of `@v12-engine/client/testing`
const client = testClient({ camera: { edgePan: true }, sounds: { level: () => 1 } })
const settings = new Settings(client, undefined)