Skip to content

@pokertools/e2e ​

End-to-end suites that exercise the full stack. The package holds two independent paths with separate Vitest configs:

  • Docker E2E (vitest.config.ts, tests/docker-e2e.test.ts) — a single-chain SQLite smoke run over the Docker Compose stack.
  • Finance/custody acceptance (vitest.finance.config.ts, tests/finance/*) — two isolated Anvil chains, a disposable PostgreSQL + Redis pair, the real API and the real custody WithdrawalWorkflow over durable Prisma ports.

Docker E2E ​

bash
# from the repo root (builds types, SDK and Foundry fixtures first)
npm run e2e:docker

This brings up docker-compose.e2e.yml with the API, BullMQ workers, Redis, and a local Anvil chain, then runs tests/docker-e2e.test.ts. It covers health and docs routes, SIWE login, deposits claimed by exact log identity, a multiplayer table (buy-ins, actions, stand), a reserved EIP-712 withdrawal driven through the custody workflow, and WebSocket observation delivery.

ConcernDetail
DatabaseSQLite bind-mounted from POKERTOOLS_E2E_RUNTIME
ChainStandalone Anvil on 127.0.0.1:8545; no external RPC keys
Contract fixtureMockUSDC (direct-treasury deposits do not use a batch contract)
SecretsDeterministic local-only values, never production

Finance / custody acceptance ​

bash
# from the repo root
npm run e2e:finance

The runner builds the Foundry fixtures and launches the suite; the suite's global setup starts two distinct Anvil chains (31337/31338) and fresh postgres:18-alpine + redis:8-alpine containers on ephemeral ports, then runs tests/finance/*. Balances under assertion come from real on-chain transfers and balanced journal postings.

FileCovers
harness-smoke.test.tsTwo-chain topology, 6/18-decimal assets, exact ERC-20 log identity, snapshot/revert, quorum proxies
quorum-disagreement.acceptance.test.tsChainRegistry quorum: distinct endpoints, duplicate/chain-mismatch rejection, disagreement + freeze
deposit-claim.acceptance.test.tsExact-log deposit verification: wrong chain/token/sender/recipient, depth, frozen asset
deposit-ledger.acceptance.test.tsDeposit credits the exact on-chain amount once and is idempotent
api-routes.acceptance.test.tsReal Fastify + SIWE: assets, balances, deposit claim, withdrawal intents, bad signature, 404s
withdrawal-custody.acceptance.test.tsPersist-before-broadcast, broadcast, quorum finality, restart from PostgreSQL, exact-byte recovery, gas starvation, reorg obligation
reconciliation-incidents.acceptance.test.tsReal shortfall incident + freeze, matched reconciliation, operator resolution, quorum fail-closed

Helpers live in tests/finance/helpers/: anvil-two-chain.ts, quorum-proxy.ts, fresh-infra.ts, custody-harness.ts, prisma-accounting.ts, eip712.ts, finance-fixtures.ts, finance-api-harness.ts, setup-env.ts, infra.ts. tests/finance/helpers/fresh-infra.ts generates a private PostgreSQL Prisma client and applies the reviewed migrations from packages/api/prisma/postgres; vitest.finance.config.ts redirects the workspace generated/prisma import to it, so the shared SQLite client is never modified.

The Foundry fixture packages/custody/contracts/test/acceptance/MockAssetToken.sol is test-only and never ships as custody code.

Relation to unit/integration tests ​

LayerWhereWhat
Engine rulespackages/engine/testsReducer correctness, invariants, security
Evaluatorpackages/evaluator/testsScores, frequencies, validation
API + DBpackages/api/testsRoutes, workers, ledger integrity, canonical protocol
Custodypackages/custody/testsWithdrawal workflow, signing config, startup gate
Contractspackages/custody/contractsFoundry unit tests against Anvil
Stackpackages/e2eEverything wired together

WARNING

Docker E2E and the finance acceptance suite require Docker, Foundry and separate infrastructure; they are not part of the default unit test run.

Released under the MIT License.