Skip to content

web: add unit tests for the date and label formatters - #70

Open
nahuel007ng wants to merge 1 commit into
joelborch:mainfrom
nahuel007ng:test/web-fmt-formatters
Open

nahuel007ng wants to merge 1 commit into
joelborch:mainfrom
nahuel007ng:test/web-fmt-formatters

Conversation

@nahuel007ng

Copy link
Copy Markdown

What

Closes #64

Adds apps/web/src/lib/fmt.test.ts with 24 tests for apps/web/src/lib/fmt.ts, which had no tests. fmt.ts itself is unchanged.

  • initials: two names, one name, three names (first and last), blank input.
  • visibleTags: drops ext: tags and keeps the rest.
  • daysUntil and dueLabel: today, tomorrow, yesterday, 2 to 6 days out, a later date this year, and a date in another year.
  • snoozePreset: tomorrow and week from a mid-week day and from a Monday (lands on the next Monday at 9:00).
  • snoozeUntilLabel: lowercases today and tomorrow mid-sentence, and leaves "Fri" and "12 Mar" alone.

Dates use the local new Date(y, m, d, h) constructor with fake timers, so the tests do not depend on the time zone. They pass with TZ set to UTC, America/Buenos_Aires, Pacific/Kiritimati (UTC+14) and Pacific/Pago_Pago (UTC-11).

Gates run locally with Node 22 and pnpm 11.12.0: pnpm typecheck passes, pnpm -r test passes (web 131, core 415, api 476, importer 63), and pnpm --filter @flow/web build succeeds.

Checklist

  • pnpm typecheck and pnpm -r test pass locally
  • No secrets or real config values (account IDs, hostnames, tokens, wrangler.jsonc) are included — only wrangler.example.jsonc placeholders
  • Changes to the API contract (routes, @flow/shared schemas, DO storage shape, MCP tools) are called out below
  • Docs / READMEs updated if behavior or setup changed (no behavior change)

Contract changes

None

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.

Unit tests for the web app's date and label formatters

1 participant