test: server unit tests, working client Jest, and working client lint - #2880
Open
hanapotski wants to merge 3 commits into
Open
test: server unit tests, working client Jest, and working client lint#2880hanapotski wants to merge 3 commits into
hanapotski wants to merge 3 commits into
Conversation
Add Jest suites for the JWT session middleware, request validation schemas, stakeholder row mapping, CSV import helpers, SQL literal helpers, and the suggestion, category, tag, parent organization, announcements, and feature controllers. Pin snapshotFormat.printBasicPrototype to false in jest.config.ts so the inline snapshots in account.test.ts match on Jest 28, and update CLAUDE.md to reflect that the server suite now passes clean. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The client Jest config sends every file through babel-jest, but the Babel config had no TypeScript preset, so any .ts/.tsx import failed to parse. Add @babel/preset-typescript (7.x, matching @babel/core) and pin Jest roots to src/ so it stops picking up the Playwright specs in tests/. Stub axios, window.scrollTo, and the analytics dataLayer in App.test.js so the render test no longer makes real network requests or logs after completion, and assert that the app actually mounts. Add a test:unit script and update CLAUDE.md. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The client lint script pointed at .eslintrc.json extending "react-app", but eslint was never installed after the Vite migration, so lint could not run at all. Replace it with eslint.config.mjs on ESLint 9 with @eslint/js, typescript-eslint, eslint-plugin-react, the two classic react-hooks rules, and eslint-config-prettier last so Prettier keeps owning formatting. Fix everything the new config reports as an error: - hooks called after an early return in StakeholderDetails (split into a null-checking wrapper and a content component) - useMemo inside a Formik render prop in OrganizationEdit (computed directly; the callback re-runs every render anyway) - anonymous DataGrid cell components in VerificationAdminGridMui - unused imports, types, and variables; empty object types; a useless try/catch; a stray non-breaking space; prefer-const and boolean-cast autofixes; a sparse-array typo in jest.config.cjs Lint now reports 0 errors and 10 react-hooks/exhaustive-deps warnings. Update CLAUDE.md sections 3, 7, and 10 accordingly. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
SAUMILDHANKAR
self-requested a review
September 8, 2026 12:18
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
Server
server/__test__/.account.test.ts. They were purely a pretty-format mismatch (Object { ... }on Jest 28 vs{ ... }in the inline snapshots). SettingsnapshotFormat: { printBasicPrototype: false }injest.config.tsresolves it without rewriting any snapshots.Client Jest
babel-jest, butbabel.config.jsonhad no TypeScript preset, so any.ts/.tsximport failed to parse. Adds@babel/preset-typescript(7.x, matching@babel/core) and pins Jestrootstosrc/so it no longer picks up the Playwright specs intests/.App.test.jsnow stubs axios,window.scrollTo, and the analyticsdataLayer, so the render makes no real network requests and logs nothing after completion. It also asserts the app actually mounts and posts its visit event.test:unitscript (jest --ci), sincenpm testin the client launches Playwright.Client lint
.eslintrc.json(extendingreact-app, with noeslintinstalled) with a flateslint.config.mjson ESLint 9:@eslint/js,typescript-eslint,eslint-plugin-react, the two classicreact-hooksrules, andeslint-config-prettierlast so Prettier keeps owning formatting.npm run lintis noweslint ..no-explicit-anyoff, unused arguments ignored but unused variables and imports are errors,react/no-unescaped-entitiesoff for prose in JSX. Playwright specs are linted withrules-of-hooksoff becausetest.extendfixtures take ausecallback the rule mistakes for React'suse.StakeholderDetailscalleduseMemoand twouseEffects after an earlyreturn null. Split into a null-checking wrapper and a content component whose hooks always run.OrganizationEditcalleduseMemoinside a Formik render prop. Now computed directly, since the callback re-runs every render anyway.VerificationAdminGridMuireturned anonymous DataGrid cell components; they are now named.prefer-constand boolean-cast autofixes, and a sparse-array typo injest.config.cjs.react-hooks/exhaustive-depswarnings, left as warnings for follow-up.Docs
CLAUDE.mdsections 3, 7, and 10 updated to describe the working setup for both workspaces.Notes
removefunctions always resolve with a status object. The tests cover the real contract; the dead branch is left as is.babel.config.json, so the added preset only affects Jest.client/package.jsonstill carries an inertreact-scriptsentry underoverrides; left for a dependency-focused change.Test plan
Server, from
server/:npx jest --ci— 14 suites, 183 tests, 10 snapshots passnpm run typecheck— cleannpm run lint— cleanClient, from
client/:npm run test:unit— 2 suites, 7 tests pass, no console noisenpm run lint— 0 errors, 10 warningsnpm run typecheck— cleanWritten by Claude on behalf of @hanapotski
🤖 Generated with Claude Code