Skip to content

[Testing] useSettings localStorage persistence and formatAmountWithPreference are untested #882

Description

@grantfox-oss

Telegram (ask questions / claim the issue here first): https://t.me/+DOylgFv1jyJlNzM0

Why this matters

src/hooks/useSettings.ts persists theme/displayCurrency/amountFormat/decimalPlaces to localStorage, applies the theme class, and exports formatAmountWithPreference() which does bigint scaling and truncates to the user's decimalPlaces preference. This formatter feeds amount display and is untested - fractional truncation to 2/4/7 places and trailing-zero trimming have no coverage.

Acceptance criteria

  • Test setTheme/setDecimalPlaces etc. write the expected STORAGE_KEYS values and update state
  • Test the hook hydrates settings from pre-seeded localStorage values
  • Test formatAmountWithPreference truncates to 2/4/7 decimals, trims trailing zeros, and handles bigint/number/string inputs

Files to touch

  • frontend/src/hooks/useSettings.ts

Out of scope

  • Settings page label/htmlFor a11y

Activity

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

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programfrontendFrontend related tasksgood first issueGood for newcomerstestingTesting related tasks

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions