fix: repair failing cross-package tests and type errors - #149
Open
stooit wants to merge 1 commit into
Open
Conversation
…e format - api.ts: follow useThrottle->useDebounce rename in @e2e/utils, keep useSearchDebounce alias - Button: apply aria-label to icon-only buttons with trimmed fallback + dev warning [WCAG 4.1.2] - DataTable: use functional setState updater to fix sort-direction stale closure - formatDate: emit non-padded day-first en-AU format via formatToParts - bunfig.toml: register happy-dom via preload (invalid 'environment' key was ignored by bun) - tsconfig.json: add bun-types so bun:test type declarations resolve All 13 tests pass and tsc --noEmit is clean. No test files modified, no dependencies added.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes all 9 failing tests and all type errors across the monorepo. After these changes
bun testreports 13 pass / 0 fail andtsc --noEmitexits 0. No test files were modified and no dependencies were added.The bugs spanned all three packages plus test-environment configuration. Root causes were identified via a
planinvestigation, implemented viacode, and confirmed via areviewpass.Fixes
apps/web/src/lib/api.tsuseThrottle, which was renamed touseDebouncein@e2e/utils— the failed import aborted module evaluation, failing bothapi.test.tscasesuseDebounce; keep the publicuseSearchDebouncealias unchangedpackages/ui/.../Button/Button.tsxariaLabelprop was destructured but never rendered — icon-only buttons had no accessible name (WCAG 2.2 SC 4.1.2)aria-labelfor icon-only buttons with a trimmed fallback chain (explicit label -> string children ->"Button") plus a dev-onlyconsole.warn; non-icon buttons still get no attributepackages/ui/.../DataTable/DataTable.tsxsetState, reading a render-scopedsortDir(stale closure)setSortDir(prev => prev === "asc" ? "desc" : "asc")packages/utils/src/format/date.tsformatDatezero-padded the day (01/03/2024) but the spec wants non-padded day-first (1/03/2024)en-AUlocale; de-pad the day viaformatToParts.formatDateTimeuntouchedbunfig.toml[test] environment = "happy-dom"is not a valid key in Bun 1.4.0 and was silently ignored, so no DOM was registered for barebun test(document is not defined)preload = ["./packages/ui/test/setup.ts"](the setup file already registers happy-dom)tsconfig.jsonbun:testmodule type declarations were not resolved (TS2307)"types": ["bun-types"]—bun-typesis already installedAssumptions & decisions
en-AUlocale and usedformatToPartsto strip only the day's zero-padding, rather than switching todateStyle: "short"(which would silently change every date display to a 2-digit year) or changing the locale tag."Button"literal is a mechanical WCAG-passing safety net; the devconsole.warn(gated on non-production) exists to push callers toward supplying a real label. Empty/whitespaceariaLabelon icon-only buttons is treated as "no label".bun:testerrors were pre-existing config noise, but the task required eliminating all type errors, so they were fixed viatsconfigconfig only — no dependency added.BUG:/present-tense comments describing the now-fixed defects were updated so the source no longer misdescribes itself.Verification