Skip to main content

Class: PocketIcServer

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.

Example

import { PocketIc, PocketIcServer } from '@hadronous/pic';
import { _SERVICE, idlFactory } from '../declarations';

const wasmPath = resolve('..', '..', 'canister.wasm');

const picServer = await PocketIcServer.create();
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();

Methods

start()

static start(options): Promise< PocketIcServer >

Start a new PocketIC server.

Parameters

options: ServerStartOptions= {}

Options for starting the server.

Returns

Promise< PocketIcServer >

An instance of the PocketIC server.

Source

pocket-ic-server.ts:63


getUrl()

getUrl(): string

Get the URL of the server.

Returns

string

The URL of the server.

Source

pocket-ic-server.ts:115


stop()

stop(): Promise< void >

Stop the server.

Returns

Promise< void >

A promise that resolves when the server has stopped.

Source

pocket-ic-server.ts:124