test(lcms): failing unit tests demonstrating review findings B1–B7 (for #232)#312
Open
PiTrem wants to merge 1 commit into
Open
test(lcms): failing unit tests demonstrating review findings B1–B7 (for #232)#312PiTrem wants to merge 1 commit into
PiTrem wants to merge 1 commit into
Conversation
Adds src/__tests__/units/pr232_review_blocking.test.tsx, one self-contained suite that reproduces each of the seven blocking issues raised in the review of this PR. Every test asserts the correct (post-fix) behaviour, so it fails on the current branch and turns green once the bug is fixed. - B1 saga_ui.js: peak-add no longer dispatches EDITPEAK.ADD_POSITIVE on non-LCMS layouts (NMR/IR/MS), so peak-add silently no-ops. - B2 integration.js getArea: trapezoidally integrates the cumulative `k` curve instead of returning k(xU)-k(xL); wrong NMR/CV integral. - B3 integration.js getAbsoluteArea: uses cumulative `k` instead of raw `y`. - B4 chem.js Convert2Peak: LC/MS branch discards stored peaks and ignores offset. - B5 multi_focus.js: CV current-density factor double-divides by 100 for mm². - B6 d3_line_rect/index.js: componentDidUpdate dereferences data[0] unguarded. - B7 rect_focus.js drawBar: dereferences tTrEndPts[0] with no length guard. Run: yarn test --watchAll=false src/__tests__/units/pr232_review_blocking.test.tsx
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.
These are failing unit tests that reproduce the seven blocking issues from the review of #232. They are meant to land on the
231-display-lcms-databranch as a red baseline to fix against — each test asserts the correct (post-fix) behaviour, so it fails today and turns green once the bug is fixed. No production code is changed.How to run
yarn test --watchAll=false src/__tests__/units/pr232_review_blocking.test.tsx(Run against Node 22.17.x, the CI version.)
What each test shows (current result on branch head)
sagas/saga_ui.jsEDITPEAK.ADD_POSITIVEUPDATE_HPLCMS_PEAKS→ peak-add silently no-ops on NMR/IR/MShelpers/integration.jsgetAreak(xU)−k(xL)= 3kcurve again); also not invariant to a baseline shift ofk(→ 304.5)helpers/integration.jsgetAbsoluteAreay= 1.0k)helpers/chem.jsConvert2Peak[{x:3,y:100}][{x:11,y:5}](recomputed from raw data, offset ignored)components/d3_multi/multi_focus.js/100for mm²components/d3_line_rect/index.jsTypeError: Cannot read properties of undefined (reading '0')components/d3_line_rect/rect_focus.jsdrawBartTrEndPtsis empty (threshold cleared)TypeError: … reading 'y'The one passing test is the B7 precondition (
convertThresEndPts(feature, '')returns[]), confirming a cleared threshold produces the empty endpoint list that then crashesdrawBar.Notes
drainSelectsgenerator-stepping pattern (__tests__/units/sagas/saga_ui_lcms.test.tsx).MultiFocus.prototype.computeYTransformFactor; B7 invokes the realdrawBaron a stubbedRectFocusinstance.componentDidMountvs unguardedcomponentDidUpdateaccess forms verbatim becauseViewerLineRectis not exported; exporting it would let the test drive the real lifecycle.Suggested fixes are summarised in the review of #232.