0.2.0 • Published 1 year ago
ganache-testcontainers v0.2.0
This project is part of the Chainfile ecosystem; it provides a Docker image for running Ganache in a container for toolchain isolation.
npm i -D ganache-testcontainers viem
import { afterAll, beforeAll, expect, it } from '@workspace/jest/globals';
import { GanacheClient, GanacheContainer, StartedGanacheContainer } from './index';
let container: StartedGanacheContainer;
beforeAll(async () => {
container = await new GanacheContainer().start();
});
afterAll(async () => {
await container.stop();
});
it('should rpc(eth_blockNumber) via viem', async () => {
const client: GanacheClient = container.client;
const blockNumber = await client.getBlockNumber();
expect(blockNumber).toBeGreaterThanOrEqual(0n);
});