Skip to content

test: CosmosValidator has no unit tests; the valid path is never reached by vitest #2

Closed

Description

@Dhananjay-alt

Coverage shows cosmos.ts:21, the success return, as never executed. Cosmos is only exercised by scripts/test-differential.mjs, which isn't part of npm test or test:coverage. Untested areas:

  • each chain's HRP (osmo, inj, etc.) being rejected by the other chains
  • the length policy: 32-byte accounts allowed on cosmos/osmosis/sei, rejected on injective/celestia
  • Bech32m rejection, non-zero padding, and the cosmosvaloper/valcons/pub prefixes

Proposed fix (PR to follow): added tests/cosmos.test.ts with 15 cases.

Activity

  1. Dhananjay-alt commented on Nov 21, 2026

    @Dhananjay-alt
    ContributorAuthor

    Fixed in #10.

    Added tests/cosmos.test.ts covering every Cosmos chain prefix, the 20/32-byte length rules, Bech32m, padding and operator/consensus prefixes (commit f0962c9).

  2. Samarth208P commented on Nov 21, 2026

    @Samarth208P
    Owner

    Confirmed on main. The Vitest coverage run passes all 220 tests, but it never reaches the successful return in CosmosValidator. The separate differential suite already checks valid accounts for all five chains and the per-chain length rules.

    I’d prioritize a small table-driven unit test for the public result on each chain, plus cross-chain prefix rejection and the 32-byte distinction for Injective and Celestia. That gives contributors running npm test an immediate signal if a supported account format breaks.

  3. added a commit that references this issue on Nov 21, 2026
    ac99ec0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions