Skip to content

test: cover ui/chart.rs and app.rs state transitions #31

Description

@kleyt0n

Problem

src/ui/chart.rs is 372 lines with 0 tests. src/app.rs is 1138 lines with 6 — the thinnest ratio in the tree, against src/ui/mod.rs at 47/3179 — and it holds the entire state machine: move_bucket, clear_bucket, toggle_focus, cycle_granularity, scroll_pane, select_session_row.

Why it matters

Every keypress goes through app.rs, and #22 will add a scan-swap path that has to preserve all of that state. Testing it is a prerequisite for changing it safely.

What to do

  • Chart bucketing and the other bucket at MODEL_SLOTS = 6.
  • State transitions in app.rs, including bounds — moving past the last bucket, clearing an already-clear bucket, cycling granularity round the loop.
  • Apply the repo's existing arithmetic-test convention: regrouping a chart by day, week or month must not change the grand total (docs/guide/building.md:76-85).

Acceptance

Both files have coverage of their branch logic, and a granularity change is proven total-preserving.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is neededrustPull requests that update rust code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions