Skip to content

test(info): cover every Info API method body and InfoClient wrapper offline - #74

Merged
joeblau merged 1 commit into
mainfrom
test/coverage-cov-info
Jul 27, 2026
Merged

test(info): cover every Info API method body and InfoClient wrapper offline#74
joeblau merged 1 commit into
mainfrom
test/coverage-cov-info

Conversation

@joeblau

@joeblau joeblau commented Jul 27, 2026

Copy link
Copy Markdown

What & why

Tests only — no src/ changes. Brings src/api/info to 100% line coverage in the offline test run (HL_OFFLINE=1 bun test tests/), closing the gap where every method body (parse(params) + config.transport.request("info", …)) and every InfoClient wrapper was previously exercised only by the skipped-when-offline live tests.

How:

  • tests/api/info/_mockInfoTransport.ts (existing mock): now also records the AbortSignal of each call, and is async so a throwing handler surfaces as a rejection the way a real transport's failures do.
  • New tests/api/info/_offlineMethodTests.ts: a shared battery each method's test file runs — exact wire payload for every valid-params combo (defaults, optionals, nulls, picklists, orderStatus oid-as-number vs cloid), ValidationError with zero requests for invalid params, response/error/signal passthrough, and identical behavior through the InfoClient wrapper. Covers the params-or-AbortSignal overloads (allMids, meta, metaAndAssetCtxs, perpsAtOpenInterestCap) in both directions.
  • The four paginated *All helpers whose InfoClient wrappers were uncovered (candleSnapshotAll, fundingHistoryAll, userNonFundingLedgerUpdatesAll, userTwapSliceFillsByTimeAll) get the same "is exposed on InfoClient with identical behavior" test as userFillsByTimeAll, including signal threading through the pagination loop.

One behavior worth noting: orderStatus with a small numeric-looking cloid (e.g. 0x000…01) sends oid as a number — the UnsignedInteger arm of the union matches first. The new tests pin that and use an out-of-safe-integer-range cloid (0xffff…) to cover the string arm.

Coverage (HL_OFFLINE=1 bun test tests/ --coverage --coverage-reporter=lcov, DA lines)

Area Before After
src/api/info/_methods 899/1420 (63.3%) 1482/1482 (100.0%)
src/api/info/client.ts 169/299 (56.5%) 299/299 (100.0%)
src/api/info total 1148/1799 (63.8%) 1861/1861 (100.0%)

No BRDA (branch) misses remain in src/api/info. Per-file before/after:

Details
File Before % After %
_methods/activeAssetData.ts 10/19 52.6% 20/20 100.0%
_methods/allBorrowLendReserveStates.ts 7/14 50.0% 15/15 100.0%
_methods/allMids.ts 8/20 40.0% 20/20 100.0%
_methods/allPerpMetas.ts 7/11 63.6% 12/12 100.0%
_methods/approvedBuilders.ts 9/18 50.0% 19/19 100.0%
_methods/borrowLendReserveState.ts 9/18 50.0% 19/19 100.0%
_methods/borrowLendUserState.ts 9/18 50.0% 19/19 100.0%
_methods/clearinghouseState.ts 10/19 52.6% 20/20 100.0%
_methods/delegations.ts 9/18 50.0% 19/19 100.0%
_methods/delegatorHistory.ts 9/18 50.0% 19/19 100.0%
_methods/delegatorRewards.ts 9/18 50.0% 19/19 100.0%
_methods/delegatorSummary.ts 9/18 50.0% 19/19 100.0%
_methods/exchangeStatus.ts 7/11 63.6% 12/12 100.0%
_methods/extraAgents.ts 9/18 50.0% 19/19 100.0%
_methods/frontendOpenOrders.ts 10/19 52.6% 20/20 100.0%
_methods/gossipPriorityAuctionStatus.ts 7/14 50.0% 15/15 100.0%
_methods/gossipRootIps.ts 7/11 63.6% 12/12 100.0%
_methods/historicalOrders.ts 9/18 50.0% 19/19 100.0%
_methods/isVip.ts 9/14 64.3% 15/15 100.0%
_methods/l2Book.ts 10/15 66.7% 16/16 100.0%
_methods/leadingVaults.ts 9/18 50.0% 19/19 100.0%
_methods/legalCheck.ts 9/18 50.0% 19/19 100.0%
_methods/liquidatable.ts 7/11 63.6% 12/12 100.0%
_methods/marginTable.ts 9/18 50.0% 19/19 100.0%
_methods/maxBuilderFee.ts 10/19 52.6% 20/20 100.0%
_methods/maxMarketOrderNtls.ts 7/11 63.6% 12/12 100.0%
_methods/metaAndAssetCtxs.ts 8/20 40.0% 20/20 100.0%
_methods/openOrders.ts 10/19 52.6% 20/20 100.0%
_methods/orderStatus.ts 10/19 52.6% 20/20 100.0%
_methods/perpAnnotation.ts 8/17 47.1% 18/18 100.0%
_methods/perpCategories.ts 7/11 63.6% 12/12 100.0%
_methods/perpConciseAnnotations.ts 7/14 50.0% 15/15 100.0%
_methods/perpDeployAuctionStatus.ts 7/14 50.0% 15/15 100.0%
_methods/perpDexLimits.ts 8/17 47.1% 18/18 100.0%
_methods/perpDexStatus.ts 8/17 47.1% 18/18 100.0%
_methods/perpsAtOpenInterestCap.ts 8/20 40.0% 20/20 100.0%
_methods/portfolio.ts 9/18 50.0% 19/19 100.0%
_methods/preTransferCheck.ts 10/19 52.6% 20/20 100.0%
_methods/predictedFundings.ts 7/11 63.6% 12/12 100.0%
_methods/recentTrades.ts 8/17 47.1% 18/18 100.0%
_methods/referral.ts 9/18 50.0% 19/19 100.0%
_methods/settledOutcome.ts 9/18 50.0% 19/19 100.0%
_methods/spotClearinghouseState.ts 9/18 50.0% 19/19 100.0%
_methods/spotDeployState.ts 9/18 50.0% 19/19 100.0%
_methods/spotMetaAndAssetCtxs.ts 7/11 63.6% 12/12 100.0%
_methods/spotPairDeployAuctionStatus.ts 7/14 50.0% 15/15 100.0%
_methods/subAccounts.ts 9/18 50.0% 19/19 100.0%
_methods/subAccounts2.ts 9/18 50.0% 19/19 100.0%
_methods/tokenDetails.ts 9/18 50.0% 19/19 100.0%
_methods/twapHistory.ts 9/18 50.0% 19/19 100.0%
_methods/userAbstraction.ts 9/18 50.0% 19/19 100.0%
_methods/userBorrowLendInterest.ts 11/20 55.0% 21/21 100.0%
_methods/userDexAbstraction.ts 9/18 50.0% 19/19 100.0%
_methods/userFees.ts 9/18 50.0% 19/19 100.0%
_methods/userFills.ts 10/19 52.6% 20/20 100.0%
_methods/userFunding.ts 11/20 55.0% 21/21 100.0%
_methods/userRateLimit.ts 9/18 50.0% 19/19 100.0%
_methods/userRole.ts 9/18 50.0% 19/19 100.0%
_methods/userToMultiSigSigners.ts 9/18 50.0% 19/19 100.0%
_methods/userTwapSliceFills.ts 9/18 50.0% 19/19 100.0%
_methods/userVaultEquities.ts 9/18 50.0% 19/19 100.0%
_methods/validatorL1Votes.ts 7/11 63.6% 12/12 100.0%
_methods/validatorSummaries.ts 7/11 63.6% 12/12 100.0%
_methods/vaultSummaries.ts 7/11 63.6% 12/12 100.0%
_methods/webData2.ts 9/18 50.0% 19/19 100.0%
client.ts 169/299 56.5% 299/299 100.0%

Verification

  • bun run check — all stages pass (format, lint, docs, types, ts7, jsdoc, export).
  • HL_OFFLINE=1 bun test tests/ — 1309 pass, 236 skip (live tests), 0 fail.

Type of change

  • Bug fix
  • New API method / feature
  • Schema/type update to match the Hyperliquid API
  • Breaking change
  • Tests / coverage only

…ffline

Each method's test file now runs a shared offline battery over a mock
transport: exact wire payload for every valid-params combo, ValidationError
with zero requests for invalid params, response/error/signal passthrough,
and identical behavior through the InfoClient wrapper (including the
params-or-AbortSignal overloads and the paginated *All helpers).

src/api/info line coverage: 63.8% -> 100% (offline run).
@joeblau
joeblau merged commit cb3823a into main Jul 27, 2026
4 of 5 checks passed
@joeblau
joeblau deleted the test/coverage-cov-info branch July 27, 2026 05:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant