How to test a ledger canister with archive functionality (ICRC3) written in Motoko?

I am developing in motoko a ICRC1/2 compatible ledger with archive functionality (ICRC3 standard) and I need to create a testing setup so I can develope tests to check the ledger adding and retrieval as well as the creation and retrieval of archive canisters. Is there a recommended way to do this testing setup?

There are similar tests in this middleware here GitHub - Neutrinomic/devefi_icrc_ledger
using PicJS 🧪 Announcing PicJS: TypeScript/JavaScript support for PocketIC!
Basically, you create all the needed canisters inside the test and then make calls to their public methods and check if the results are as expected.

You can just create a ledger canister, send enough transactions (from your test script) to trigger archival, and then test the icrc3 methods. Your main ledger canister will create new archive canisters and you can test them too.

2 Likes