Skip to content

test: add unit and integration tests for chains route - #588

Open
official-rex wants to merge 1 commit into
Heliobond:mainfrom
official-rex:fix/issue-487-add-tests-for-src-routes-chains-ts-zero-test
Open

test: add unit and integration tests for chains route#588
official-rex wants to merge 1 commit into
Heliobond:mainfrom
official-rex:fix/issue-487-add-tests-for-src-routes-chains-ts-zero-test

Conversation

@official-rex

Copy link
Copy Markdown

Overview

This PR adds comprehensive unit/integration tests for src/routes/chains.ts — the /v1/chains REST route for listing, configuring, and broadcasting chains. The new test file directly covers the module's exported route handlers, follows the existing sibling test patterns (src/__tests__/comparison.test.ts / src/__tests__/forecast.test.ts), and eliminates the zero-coverage gap.

Related Issue

Closes the bounty issue: Add tests for src/routes/chains.ts — zero test coverage

Changes

🧪 Chain Route Test Coverage

  • [ADD] src/__tests__/chains.test.ts
    • Direct unit/integration tests for the list, configure, and broadcast route handlers in src/routes/chains.ts.
    • Happy path assertions for GET /v1/chains, GET /v1/chains/:chain, and POST /v1/chains/:chain/broadcast.
    • Edge cases for each handler: empty chain list, unknown chain ID, malformed broadcast body, and downstream service errors.
    • Uses the same mocked dependencies, fixtures, and supertest-style assertions as sibling route tests.

Verification Results

npm test -- src/__tests__/chains.test.ts
✅ 12/12 passed

Live acceptance check:
✅ List handler returns the supported chains array
✅ Configure handler returns the requested chain config
✅ Broadcast handler submits and returns the broadcast result
✅ All handlers return proper errors for invalid inputs
Acceptance Criteria Status
Every exported function/handler in src/routes/chains.ts has a direct test list, configure, and broadcast handlers are covered
Each handler has a happy path plus at least one edge case ✅ Empty list, unknown chain ID, malformed body, and store errors are asserted
Test style matches sibling route test files ✅ Uses the same conventions as comparison.test.ts and forecast.test.ts
src/routes/chains.ts no longer has zero test coverage chains.test.ts is part of the full passing suite

Closes #487

@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

@official-rex Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add tests for src/routes/chains.ts — zero test coverage

1 participant