This repository is a minimal demonstration package for running Arkiv SDK integration tests.
It is modeled after the test package in Arkiv-Network/arkiv-sdk-js, but keeps the scope intentionally small with two simple read checks and one write example against a local Arkiv node launched via testcontainers.
- a tiny npm package that depends on
@arkiv-network/sdk - integration tests using Node's built-in test runner
- a local Arkiv node launched on demand with
testcontainers - simple assertions for:
getChainId()getBlockTiming()createEntity()plus a read-back check viagetEntity()
- Node.js 24 or newer
- Docker
npm installnpm install github:Arkiv-Network/arkiv-js-sdk-testThis installs this demo integration-test package directly from the repository. The package is plain JavaScript, so there is no separate build step or compiled dist/ output to keep in the repository. The GitHub install uses the checked-in package files directly.
npm testOr run the integration-only script explicitly:
npm run test:integrationThis package is best used as a small, copyable template. The main reusable pieces are:
test/arkiv.integration.test.jsfor a full working exampleexamples/arkiv.integration.example.jsfor a smaller starter file you can copy into your own project
If you install from GitHub, both files are available in node_modules/arkiv-js-sdk-test/.
-
Create a Node.js project for your integration tests.
-
Install this starter package and the direct dependencies your copied test will use:
npm install github:Arkiv-Network/arkiv-js-sdk-test @arkiv-network/sdk testcontainers viem
-
Copy the starter example into your own test directory:
mkdir -p test cp node_modules/arkiv-js-sdk-test/examples/arkiv.integration.example.js test/my-feature.integration.test.jsIf you are working directly in this repository, you can copy from
examples/arkiv.integration.example.jsinstead. -
Open
test/my-feature.integration.test.jsand customize:- the payload you want to store with
createEntity() - the attributes you want to index and read back
- the assertions that prove your integration works
- any extra Arkiv SDK calls you want to verify
- the payload you want to store with
-
Run just your new test while iterating:
node --test test/my-feature.integration.test.js
-
Once your test is stable, run your normal test command such as:
npm test
The starter example already shows the basic Arkiv integration-test flow:
- launch a local Arkiv node with
testcontainers - create a public client for reads
- create a wallet client for writes
- write a JSON payload with
createEntity() - read the entity back with
getEntity() - assert on the decoded JSON payload and indexed attributes
When adapting it for your own project, the most common edits are:
- replace the example payload with your own domain data
- rename the test cases to match your feature
- add more reads after the write, depending on what your integration needs to prove
- keep the Docker startup and cleanup helpers as-is unless you need a different node configuration
- Start from
examples/arkiv.integration.example.js - Rename the test to something feature-specific such as
stores invoice metadata in Arkiv - Change the payload to the shape your app writes
- Change the final assertions so they check the fields your app depends on
- Add more tests beside it for additional Arkiv SDK operations
- These tests are real integration tests, so they require Docker access in order to launch a local Arkiv node.
- In restricted environments where Docker is unavailable, the Arkiv integration tests are skipped with a clear message instead of failing for container-connectivity reasons.
- The write example uses a fixed local development key that is imported and funded inside the ephemeral test container only.