> For the complete documentation index, see [llms.txt](https://docs.trover.tech/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.trover.tech/engineering/integration-testing.md).

# Integration and Robinhood testnet testing

## Live-provider Docker suite

Run the complete isolated stack with:

```bash
pnpm test:integration:docker
```

The command builds and starts PostgreSQL 17, Redis 7, a deterministic Relay mock, the migration job, Fastify API, BullMQ worker, and preserved Next.js web application. It loads other provider credentials from `.env`, waits for every service health check, runs Vitest on the host against the containers and configured live providers, returns the test exit code, and removes containers and volumes on exit. Relay traffic from the containers is isolated to the mock and `RELAY_DRY_RUN=true` is forced.

The end-to-end cases cover:

* API, worker, web, PostgreSQL, Redis, and provider readiness
* invalid X webhook signature rejection
* signed X mention ingestion and fast acknowledgment
* event and trade-intent deduplication
* default direct execution with all optional controls disabled
* X DM hold behavior without a transaction
* PostgreSQL and Redis idempotency round trips
* Relay chain/currency discovery, signed webhook deduplication, and signed X DM → stored dry-run quote
* live Robinhood mainnet/testnet RPC chain checks
* live Blockscout and Dexscreener reads
* live X and Privy authentication when credentials are present
* funded testnet-wallet balance when `ROBINHOOD_TESTNET_WALLET_ADDRESS` is present

The suite keeps `TRADING_DRY_RUN=true`, so it does not submit a production swap. Live provider availability and rate limits can fail the suite; that is intentional for this lane.

It also performs a read-only live Relay check for mainnet chains, currencies, and quote validation. It never signs or submits the returned quote.

## Live Robinhood Chain testnet

The read-only live lane uses Robinhood Chain Testnet chain ID `46630` and the public RPC:

```bash
pnpm test:testnet
```

It verifies the reported chain ID and reads a current block. Override `ROBINHOOD_TESTNET_RPC_URL` with an Alchemy testnet endpoint for more reliable CI.

An optional zero-value self-transfer test runs only when `TESTNET_PRIVATE_KEY` is present. Use a brand-new disposable, testnet-only wallet and include the `0x` prefix:

```bash
TESTNET_PRIVATE_KEY=0x... pnpm test:testnet
```

Obtain test ETH from the [official Robinhood Chain faucet](https://faucet.testnet.chain.robinhood.com/). The faucet requires an interactive wallet connection and may require identity/login checks, so it is deliberately not automated or bypassed by this repository. Never reuse a key pasted into chat, committed to source control, or otherwise exposed. The test first checks for a positive balance and will not broadcast when the wallet is unfunded.

Robinhood's public testnet does not publish a canonical testnet stock-token registry equivalent to the mainnet registry. Consequently, live CI verifies chain connectivity and an optional gas transaction; a stock-token swap must remain dry-run until official testnet token/router/pool addresses are configured.

## Optional funded Relay testnet bridge

Relay testnet execution is a separate, explicit opt-in. It selects a currently supported funded EVM origin and a different EVM destination with the same native symbol, requests an exact-input native bridge, executes the returned transaction steps, and polls to a successful terminal status:

```bash
ENABLE_RELAY_FUNDED_TESTNET=true \
TESTNET_PRIVATE_KEY=0x... \
pnpm test:testnet
```

Use a disposable key and keep `RELAY_FUNDED_TESTNET_AMOUNT_WEI` minimal. The test fails closed if no supported origin has enough balance or if Relay returns a signature/non-native route. Testnet DEX liquidity is not assumed. Faucets commonly require an interactive wallet/sign-in and are not automated or bypassed.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.trover.tech/engineering/integration-testing.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
