test: await fire-and-forget waitFor calls in Course.test.jsx - #2060
Merged
Merged
Conversation
Four waitFor(...) calls ran without await, so their background polls threw after their own test finished — Jest then misattributed the rejection to the next test. Three of them also wrapped an un-awaited findByText (a Promise) in the matcher, so those assertions were vacuous. await the line-351 waitFor, and rewrite the three Sequence-alert assertions as `expect(await screen.findByText(X)).toBeInTheDocument()` so they genuinely assert. Pre-existing latent bug (see the file's it.skip notes, #1669); surfaced by the async seed timing in the sequence-data React Query conversion (#2011). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
brian-smith-tcril
added this pull request to stack #2062
September 15, 2026 03:34
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2060 +/- ##
==========================================
+ Coverage 93.59% 93.66% +0.06%
==========================================
Files 368 368
Lines 6015 6015
Branches 1420 1383 -37
==========================================
+ Hits 5630 5634 +4
+ Misses 369 365 -4
Partials 16 16 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
arbrandes
approved these changes
Sep 18, 2026
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
Four
waitFor(...)calls inCourse.test.jsxran withoutawait, so their background polls threw after their own test finished, and Jest misattributed the rejection to whichever test ran next. Three of them also wrapped an un-awaitedfindByText(which returns a Promise) in the matcher, so those three assertions were vacuous (matching against a promise object, and never awaited). This awaits them so they genuinely assert.Pre-existing latent bug — the file already documents this class in its
it.skipnotes (see #1669); the base suite passed only because the leaks' timing happened not to collide. Split out as the bottom of the stack so the sequence-data → React Query conversion (#2011, on top) stays sequence-only — but it's a prerequisite: the async seed timing in #2011 makes the line-351 leak collide reliably and turn the suite red.What changed
Only
src/courseware/course/Course.test.jsx:awaitthe fire-and-forgetwaitForin "passes handlers to the sequence".expect(await screen.findByText(X)).toBeInTheDocument()so they genuinely assert.Left untouched: three un-awaited
waitFors insideit.skipblocks (they don't run).Testing
npm run types(0 errors),npm run lint(clean), and the full suite green. The four cases pass in isolation and the suite is green consecutively. No production behavior change — with the line-351waitForproperly awaited, "passes handlers to the sequence" still renders Previous/Next and fires its handlers as before.🤖 Generated with Claude Code