fix: resolve cross-package test failures and type errors - #107
Open
stooit wants to merge 1 commit into
Open
Conversation
- api.ts: correct renamed hook import (useThrottle -> useDebounce) [TS2305] - Button: apply aria-label to button element for icon-only buttons [WCAG-4.1.2] - DataTable: consolidate sort state to avoid stale-closure/StrictMode hazard - date: day-first, unpadded D/M/YYYY so 1 March renders 1/3/2024 - tsconfig: wire up existing bun-types devDependency (fixes bun:test resolution)
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 failing tests and type errors across the monorepo.
bun run test→ 13 pass / 0 fail;tsc --noEmit→ 0 errors. No test files modified; no dependencies added.Bugs fixed
apps/web/src/lib/api.ts): the hook was renameduseThrottle→useDebounceinpackages/utils, but the old name was still imported here (TS2305 + runtime crash). Import/usage updated to the current name.packages/ui/src/components/Button/Button.tsx):aria-labelwas not applied to the<button>element for icon-only buttons. Now forwarded to satisfy WCAG 2.2 SC 4.1.2 (accessible name).packages/ui/src/components/DataTable/DataTable.tsx): consolidated the two splituseStates into one atomic{key, dir}state updated via the functional form, removing a latent stale-closure hazard (would surface under React 18 batching / StrictMode).packages/utils/src/format/date.ts): output is now day-first and unpadded (1/3/2024for 1 March), consistent with the existingformatDateTimeshort style. UsesformatToPartsbecauseen-AUresolves day/month to 2-digit regardless of requested options.Assumptions & notes
bun testskips the happy-dom preload and produces falsedocument is not definederrors; the canonical runner is the rootbun run testscript, which preloads the DOM setup. All fixes verified against that.tsconfig.jsongained"types": ["bun-types"]to wire up the already-present (but unreferenced)bun-typesdevDependency, resolving pre-existingCannot find module 'bun:test'errors. No new dependency added.aria-labelis non-null even when none is passed, so a"Button"fallback plus a dev-mode warning is emitted. This satisfies the test but is a poor accessible name in practice. A stricter follow-up (noted in code comments) would be a discriminated-union prop type making the label a compile-time requirement — out of scope, as it would require editing a test.formatDatepadding change alters output for every single-digit day. No in-repo consumers depend on the padded form.Testing
bun run test— 13 pass, 0 failtsc --noEmit— clean