Repository navigation
Test the diagram's elements against real pathways - #12
Merged
Merged
Conversation
The diagram service turns Reactome's layout and graph files into the elements cytoscape draws -- some 700 lines no test touched. These check it against two real pathways, stored as fixtures exactly as the release serves them: R-HSA-9679191 (drugs, entity sets, links) and R-HSA-2206292 (a disease diagram, normal entities faded and affected ones crossed out). What a drawn diagram has to be, whatever the pathway: every element its own id, no line to something not drawn, every entity of the layout drawn as its kind, every reaction a node; and a drug marked a drug, a crossed-out entity crossed, a faded one faded and replaced by something drawn. Each was shown to catch a fault: dropping the drug class, the crossed class, a link's source, or the fade each fails exactly one test. Sub-pathway labels are laid out in a rendered cytoscape graph, which measures text on a canvas jsdom does not have; the spec gives it one that measures and draws nothing. The fixtures are left out of Prettier. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From review: - Only 2 of the 34 faded entities in MPS VII have a replacement, so the check passed with replacements gone entirely. It now covers faded reactions too and requires that some have one; crossed-out entities must not be faded. Shown failing with no replacement set. - The expected classes were read from the service's own map, so a wrong entry there passed. They are written out now; shown failing with Gene drawn as RNA. - R-HSA-69620, Cell Cycle Checkpoints, is added: sub-pathway labels, a gene, an RNA and an embedded pathway. Each label is drawn once and placed apart from the others; shown failing with one label lost. - Unanswered requests fail the test; only the canvas stub is restored, not every mock; and its comment says why it is needed even with no sub-pathways. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
DiagramService.getDiagramturns Reactome's layout and graph files into the elements cytoscape draws. That's about 700 lines, and no test covered it.These tests run it on two real pathways, stored as fixtures exactly as the release serves them:
What any drawn diagram must satisfy:
nodeTypeMap) and keeps itsreactomeId;And for these pathways:
drugclass;crossed;isFadeOut, and whatever replaces it is drawn.Shown to catch faults: I broke the service four ways, one at a time: dropped the drug class, dropped the crossed class, broke a link's source, and switched off the fade. Each made exactly one test fail; restored, all 18 pass.
avoidOverlaplays sub-pathway labels out in a rendered cytoscape graph, which measures text on a canvas that jsdom doesn't have. The spec stubs a 2D context that measures a character as 6px and draws nothing. The fixtures are minified (about 250 KB in all) and excluded from Prettier.🤖 Generated with Claude Code