Skip to content

Add unit tests for the pace duration formatter (formatEta) #79

Description

@tsouth89

Context

formatEta(seconds) in apps/desktop-tauri/src/surfaces/settings/providers/sections/PaceSection.tsx:44 renders a seconds value as a compact m/h/d string (<60m → minutes, <24h → hours, else days). It is pure and has no test file.

Task

Add unit tests for formatEta. The function is currently module-private — export it (export function formatEta) so it can be imported directly by a new PaceSection.test.tsx (or a small PaceSection.formatEta.test.ts).

Acceptance criteria

  • Covers the boundaries: 0, 59s, exactly 60s (→ 1m), 59m, 60m (→ 1h), 23h59m, 24h (→ 1d), and a multi-day value.
  • Covers negative input (function clamps minutes at 0).
  • Uses the existing vitest setup; no app launch.

How to test

pnpm --dir apps/desktop-tauri test

Pointers

  • Function: PaceSection.tsx:44
  • Sibling tests to copy the pattern from live under apps/desktop-tauri/src/lib/*.test.ts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomershelp wantedExtra attention is neededjavascriptPull requests that update javascript code

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions