Skip to content

Harden the result animation tests against silent no-ops - #2327

Merged
felladrin merged 1 commit into
mainfrom
test/harden-result-animation-tests
Aug 10, 2026
Merged

Harden the result animation tests against silent no-ops#2327
felladrin merged 1 commit into
mainfrom
test/harden-result-animation-tests

Conversation

@felladrin

Copy link
Copy Markdown
Owner

Hardens the reduced-motion and stagger tests added in #2324. They pass today, but two of them can stop testing anything without ever failing.

The reduced-motion tests read the transition styles through closest(...)?.getAttribute("style") and compare with ?? "". If the selector stops matching (a Mantine class rename, or Carousel.Slide no longer carrying role="group"), closest returns null, the ?? "" turns that into an empty string, and both assertions pass. I checked it on main: renaming the selectors to .mantine-Stack-root-renamed and [role="grouped"] leaves all 15 tests green. So both tests now assert the wrapper was found before reading its style, and a single not.toContain("transition") replaces the two narrower checks.

The stagger tests used 6 results, which put the old timing's last item at exactly 1000ms against a 1000ms timeout. They now use 15 (the default searchResultsLimit), so the old timing would need 2800ms for the text list and 3500ms for the carousel.

By the way, testUtils.ts had two exported wrappers plus a private function for what is a single call, so setReducedMotionPreference is now the only export and afterEach calls it with false.

How to test

  1. npm test (357 tests pass).
  2. npm run lint (exits 0). The architectural linter wants a TSDoc block in any file with exports, so the doc comment in testUtils.ts stays, now describing what the mock actually overrides instead of restating the function name.
  3. To confirm the tests still catch the original slow-stagger bug, put the old timing back and re-run them:
git checkout 6b89c13^ -- client/components/Search/Results/Textual/SearchResultsList.tsx client/components/Search/Results/Graphical/ImageResultsList.tsx
npx vitest run client/components/Search/Results

Four tests fail, each giving up after ~1010ms.

@felladrin
felladrin marked this pull request as ready for review August 10, 2026 13:02
@felladrin
felladrin merged commit 46b1721 into main Aug 10, 2026
7 checks passed
@felladrin
felladrin deleted the test/harden-result-animation-tests branch August 10, 2026 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant