fix: repair cross-package test failures and type errors - #155
Open
stooit wants to merge 1 commit into
Open
Conversation
- api.ts: import renamed useDebounce (was stale useThrottle) so useSearchDebounce re-export resolves - bunfig.toml: replace invalid [test] environment key with preload of the happy-dom setup so DOM tests run - Button: forward aria-label to the element with an icon-only fallback + dev warning (WCAG 4.1.2) - DataTable: use functional state updater in sort handler to avoid stale-closure read - date.ts: use en-GB so day is not zero-padded (1/03/2024) while preserving day-first order - tsconfig.json: add bun-types so bun:test module declarations resolve (clears TS2307)
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
Repairs all failing tests and type errors across the monorepo.
bun testnow reports 13 pass / 0 fail andnpx tsc --noEmitexits 0. No test files were modified; only source and config.Fixes
apps/web/src/lib/api.tsuseThrottlename (renamed touseDebouncein@e2e/utils), so theuseSearchDebouncere-export failed to resolveuseDebouncebunfig.toml(root)[test] environment = "happy-dom"— not a valid Bun option, so the DOM setup never ran and all UI tests errored withdocument is not definedpreload = ["./packages/ui/test/setup.ts"]packages/ui/src/components/Button/Button.tsxariaLabelwas destructured but never applied to the<button>, so icon-only buttons had no accessible namearia-label={ariaLabel ?? (iconOnly ? "Button" : undefined)}+ dev-mode warning (WCAG 2.2 SC 4.1.2)packages/ui/src/components/DataTable/DataTable.tsxsortDirdirectly — a latent stale-closure bugsetSortDir(prev => prev === "asc" ? "desc" : "asc")packages/utils/src/format/date.tsen-AUzero-pads the numeric day (01/03/2024); test expects1/03/2024en-GB(same day-first order, no day padding); corrected the misleading docstringtsconfig.jsonbun:testmodule declarations never loaded, producing TS2307 on every test file"types": ["bun-types"]Assumptions & notes
formatDate:en-GBis the minimal change that yields the unpadded day while keeping day-first ordering. Introduces a small locale split (formatDateTimestill usesen-AU). Verified:2024-03-01→1/03/2024,2024-06-15→15/06/2024.tsconfig.json(bun-types) was outside the originally-scoped source bugs, but the task requires eliminating all type errors and these TS2307 errors were pre-existing. Config change, not a test-file edit."Button"satisfies the assertion; the dev warning is the real accessibility nudge.Verification
bun test(repo root): 13 pass / 0 failnpx tsc --noEmit(repo root): exit 0, no errorsgit diff --name-only -- '*test*': empty (no test files touched)