Skip to content

chore(test): replace chain:'test' fixture with real registered chains in DEX adapter tests - #17

Merged
Hiksang merged 1 commit into
mainfrom
chore/dex-test-fixtures-real-chains
May 6, 2026
Merged

chore(test): replace chain:'test' fixture with real registered chains in DEX adapter tests#17
Hiksang merged 1 commit into
mainfrom
chore/dex-test-fixtures-real-chains

Conversation

@Hiksang

@Hiksang Hiksang commented May 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

Four DEX adapter test files (uniswap_v3, algebra_v3, balancer_v3, thena_cl) constructed ProtocolEntry fixtures with chain: "test", which doesn't exist in any registry. Each replacement uses a real chain that the adapter is in fact deployed on. The change is fixture-only — no registry lookups happen in these tests, so behaviour is identical.

Mapping

File Old New Why
uniswap_v3.test.ts "test" "hyperevm" hyperswap-v3, project-x, ramses-cl all use this interface
algebra_v3.test.ts "test" "hyperevm" kittenswap uses this interface
thena_cl.test.ts "test" "bnb" thena-fusion-bnb uses this interface
balancer_v3.test.ts "test" "hyperevm" No registered protocol uses balancer_v3; "hyperevm" chosen for consistency with the other V3-style adapter tests

Why

Forward-looking. Any future test that crosschecks a fixture's chain against Registry.loadEmbedded() (mirroring the address-shape pattern in PR #15) will find the chain and not silently skip assertions. The 2026-05-07 multi-chain broadcast verification surfaced one false-positive class of test that passed only because the fixture chain didn't match any real chain.

Test plan

  • pnpm -C ts -r build — clean.
  • pnpm -C ts -r lint — 3 packages, tsc --noEmit clean.
  • pnpm -C ts -r test — defi-core 32/32, defi-protocols 43/43 (unchanged), defi-cli (unchanged).
  • Reviewer: confirm none of the existing assertions in these 4 files depend on the literal string "test" (none should — the chain field is read by the adapter constructor for naming only).

🤖 Generated with Claude Code

… in DEX adapter tests

Four DEX adapter test files (uniswap_v3, algebra_v3, balancer_v3,
thena_cl) constructed ProtocolEntry fixtures with `chain: "test"`,
which doesn't exist in any registry. Each replacement uses a real
chain that the adapter is in fact deployed on:

  uniswap_v3.test.ts → "hyperevm" (hyperswap-v3, project-x, ramses-cl)
  algebra_v3.test.ts → "hyperevm" (kittenswap)
  thena_cl.test.ts   → "bnb"      (thena-fusion-bnb)
  balancer_v3.test.ts → "hyperevm" (no registered protocol; chosen for
                                    consistency with the other V3-style
                                    adapters)

The change is fixture-only — no registry lookups happen in these
tests, so behaviour is identical. The benefit is forward-looking:
any future test that crosschecks a fixture's chain against
Registry.loadEmbedded() (e.g. address-shape PR #15's pattern) will
find the chain and not silently skip the assertion.

Verified:
  - pnpm -C ts -r build  — clean.
  - pnpm -C ts -r lint   — 3 packages, tsc --noEmit clean.
  - pnpm -C ts -r test   — defi-core 32/32, defi-protocols 43/43
                           (unchanged), defi-cli 89/89 (unchanged).
@Hiksang
Hiksang merged commit 75b8e04 into main May 6, 2026
4 checks passed
@Hiksang
Hiksang deleted the chore/dex-test-fixtures-real-chains branch May 6, 2026 17:20
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.

1 participant