Skip to content

SPA tests: pure utils — tokenStore, dates.todayIso, ageWeeks #109

Closed

Description

@mforce

Follow-up to #105 / PR #106 — small pure helpers, easy wins.

Cover

  • auth/tokenStore.ts — save→load round-trip; clearTokens empties the slot; loadTokens on corrupt JSON calls removeItem and returns null; missing key → null.
  • lib/dates.ts todayIso() — returns farm-local YYYY-MM-DD (not UTC); pin with fake timers around an evening-UTC-rollover instant to prove it does not roll to the next day. Zero-pads month/day.
  • routes/FlocksPage.tsx ageWeeks (Math.max(0, Math.floor(days/7))) — extract to a testable util and cover 0/6/7/13 days + negative (pre-placement) → 0.

Part of #105, epic #14.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions