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();
Methods
Section titled “Methods”getUrl()
Section titled “getUrl()”getUrl():
string
Defined in: pocket-ic-server.ts:114
Get the URL of the server.
Returns
Section titled “Returns”string
The URL of the server.
stop()
Section titled “stop()”stop():
Promise
<void
>
Defined in: pocket-ic-server.ts:123
Stop the server.
Returns
Section titled “Returns”Promise
<void
>
A promise that resolves when the server has stopped.
start()
Section titled “start()”
static
start(options
):Promise
<PocketIcServer
>
Defined in: pocket-ic-server.ts:63
Start a new PocketIC server.
Parameters
Section titled “Parameters”options
Section titled “options”StartServerOptions
= {}
Options for starting the server.
Returns
Section titled “Returns”Promise
<PocketIcServer
>
An instance of the PocketIC server.