Skip to content

PocketIcServer

Defined in: pocket-ic-server.ts:47

This class represents the main PocketIC server. It is responsible for maintaining the lifecycle of the server process. See PocketIc for details on the client to use with this server.

import { PocketIc, PocketIcServer } from '@dfinity/pic';
import { _SERVICE, idlFactory } from '../declarations';
const wasmPath = resolve('..', '..', 'canister.wasm');
const picServer = await PocketIcServer.start();
const pic = await PocketIc.create(picServer.getUrl());
const fixture = await pic.setupCanister<_SERVICE>({ idlFactory, wasmPath });
const { actor } = fixture;
// perform tests...
await pic.tearDown();
await picServer.stop();

getUrl(): string

Defined in: pocket-ic-server.ts:114

Get the URL of the server.

string

The URL of the server.


stop(): Promise<void>

Defined in: pocket-ic-server.ts:123

Stop the server.

Promise<void>

A promise that resolves when the server has stopped.


static start(options): Promise<PocketIcServer>

Defined in: pocket-ic-server.ts:63

Start a new PocketIC server.

StartServerOptions = {}

Options for starting the server.

Promise<PocketIcServer>

An instance of the PocketIC server.