All examples are written in TypeScript with Jest or Vitest as the test runner,
but @dfinity/pic can be used with JavaScript and any other testing runner, such as NodeJS, bun or Mocha.
-
- Replace
bunwithpnpmin any subsequent commands if you choose to usepnpm.
- Replace
-
Install dependencies:
bun i
-
Build all examples:
bun build:examples
-
Test all examples:
bun test:examples
-
Build or test a single example:
bun build:examples -- counter bun test:examples -- counter
- Counter This example demonstrates how to work with a simple canister as well as init arguments, canister upgrades and WASM reinstallation.
- Clock This example demonstrates how to work with the replica's system time, canister timers as well as checking for canister existence and cycle management.
- Todo This example demonstrates how to work with more complex canisters, identities, canister upgrades, and stable memory management. It also shows how to use "live" mode with agent-js (in contrast to the pic-js actor).
- Multicanister This example demonstrates how to work with multiple canisters and multiple subnets.
- ICP Features This example demonstrates how to enable ICP features when creating a PocketIC instance.
- NNS Proxy This example demonstrates how to work with an NNS state directory.
- Google Search This example demonstrates how to mock HTTPS Outcalls.
- HTTP This example demonstrates how to use "live" mode with an HTTP canister.