fix: repair cross-package test failures and typecheck errors - #166
Open
stooit wants to merge 1 commit into
Open
Conversation
Make all 13 tests pass and clear all tsc errors across the monorepo: - api.ts: import the renamed hook (useThrottle -> useDebounce) from @e2e/utils and re-export it as useSearchDebounce, fixing the broken import that failed both api module tests (TS2305). - Button: apply aria-label to the rendered button. For icon-only buttons with no explicit label, fall back to string children (else a generic name) so they carry an accessible name (WCAG 2.2 SC 4.1.2), and warn in dev. Text buttons still omit the attribute so visible labels win. - formatDate: use en-AU with an unpadded day (1/03/2024, not 01/03/2024) matching the test's expected day-before-month output. - tsconfig: add "types": ["bun-types"] so tsc resolves bun:test; also make the DOM lib explicit and typecheck apps/*/test (previously a gap). - DataTable: behaviour-neutral switch to a functional setSortDir updater and removal of a misleading "stale closure" comment (defensive refactor; no failing test — all DataTable tests already passed). 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 failing tests and eliminates all
tsc --noEmiterrors across the monorepo. Bugs spanned three packages and one config file. No test files were modified and no dependencies were added.Result:
bun run test→ 13 pass / 0 fail;npx tsc --noEmit→ clean (exit 0).Fixes
apps/web/src/lib/api.tsuseThrottlefrom@e2e/utils, which was renamed touseDebounce(TS2305; broke bothapi moduletests)useDebounceand re-export it asuseSearchDebounce; consolidate importspackages/ui/src/components/Button/Button.tsxaria-labelwas destructured but never applied to the<button>(accessibility test failed)aria-label; for icon-only buttons with no explicit label, fall back to string children (else a generic name) and warn in dev — WCAG 2.2 SC 4.1.2. Text buttons still omit the attribute so visible labels aren't clobberedpackages/utils/src/format/date.ts01/03/2024; test expects unpadded day-before-monthen-AUwith unpadded day →1/03/2024(4-digit year, DD/MM ordering preserved)tsconfig.jsonCannot find module 'bun:test'for all test files"types": ["bun-types"](already a devDependency); make DOM lib explicit; also typecheckapps/*/test(previously an untypechecked gap)packages/ui/src/components/DataTable/DataTable.tsxsetSortDirupdater + removed a misleading "stale closure" comment. No failing test depended on thisVerification
bun run test→ 13 pass / 0 fail (the single console line during the run is the intentional dev-mode WCAG warning from the icon-only-without-label test)npx tsc --noEmit→ no output, exit 0Assumptions / notes
1/03/2024(unpadded day), soformatDateuses an unpadded day rather than the conventional zero-padded01/03/2024. Chose to honour the test's stated intent.aria-label, so a generic"button"fallback is used when no label and no string children are available. A dev-modeconsole.warnis emitted to drive callers to supply a real label; consider a lint rule for genuine 4.1.2 conformance.tsc --noEmitwas already failing onmaindue to the missingbun-types; this PR also fixes that pre-existing break.🤖 Generated with QuantCode