Skip to content

test(lib): expand unit test coverage and edge cases for core utility functions - #1537

Merged
theborakompanioni merged 2 commits into
joinmarket-webui:develfrom
abhayrajjais01:test/utils-unit-tests
Oct 18, 2026
Merged

theborakompanioni merged 2 commits into
joinmarket-webui:develfrom
abhayrajjais01:test/utils-unit-tests

Conversation

@abhayrajjais01

Copy link
Copy Markdown
Contributor

Fixes #1534

Description

Expands unit test coverage and guards edge-case error paths across core utility functions, domain validation helpers, and cryptographic utilities:

  • Core Utilities (src/lib/utils.ts):
    • Added unit test suites for isWalletFileName and sanitizeWalletName.
    • Added test cases for percentageToFactorString (custom precisions, zero, negative percentages).
    • Added error handling and loop continuation tests for setIntervalDebounced (synchronous throw & default onError).
    • Added assertions for block-time constants (BITCOIN_GENESIS_DATE, AVERAGE_BLOCKS_PER_HOUR, AVERAGE_BLOCKS_PER_DAY, AVERAGE_BLOCKS_PER_YEAR, MEAN_DURATION_BETWEEN_BLOCKS_SECONDS).
  • Key Derivation & Crypto (src/lib/bip32.ts, src/lib/xpubs.ts, src/lib/hash.ts):
    • Added direct unit test for deriveAccountXpub with an HDKey instance.
    • Added edge-case test for convertExtendedPublicKey whitespace trimming and empty base58 string error handling.
    • Added test for hashPassword default PBKDF iterations.
  • Validation & Domain Utilities (src/components/sweep/, src/lib/):
    • Added test suite for normalizeDestinationAddresses in destinationValidation.ts.
    • Added FastAPI detail array and location formatting edge-case tests in errorReason.ts.
    • Added boundary error tests for toYearsRange and malformed date strings in fidelityBondUtils.ts.

Testing

i have run all the test locally

@abhayrajjais01 abhayrajjais01 changed the title test(lib): expand unit test coverage and edge cases for core utility … test(lib): expand unit test coverage and edge cases for core utility functions Oct 14, 2026

@theborakompanioni theborakompanioni left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💪

@theborakompanioni
theborakompanioni merged commit d669e66 into joinmarket-webui:devel Oct 18, 2026
4 checks passed
@abhayrajjais01
abhayrajjais01 deleted the test/utils-unit-tests branch October 19, 2026 09:17
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.

test: expand unit test coverage and edge cases for core utility functions

2 participants