| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Add tests ensuring `AbstractGraph.createEdgeHandler` properly delegates to specialized factory methods (createElbowEdgeHandler and createEdgeSegmentHandler) based on edge style registry configuration. Tests cover both built-in edge styles and custom handler implementations.
WalkthroughThe test suite for the Graph's createEdgeHandler functionality was expanded with new tests. These tests verify that custom edge handler classes are correctly instantiated when custom edge styles are used, ensuring that the graph respects custom handler implementations associated with specific handler kinds. Global setup and teardown were added to maintain a clean edge style registry state. Changes
Sequence Diagram(s)sequenceDiagram
participant TestSuite
participant Graph
participant EdgeStyleRegistry
participant CustomEdgeHandler
TestSuite->>Graph: createEdgeHandler(edge)
Graph->>EdgeStyleRegistry: getHandlerKind(style)
alt handlerKind is 'elbow'
Graph->>CustomEdgeHandler: createElbowEdgeHandler()
else handlerKind is 'segment'
Graph->>CustomEdgeHandler: createEdgeSegmentHandler()
else
Graph->>CustomEdgeHandler: createEdgeHandlerInstance()
end
Graph-->>TestSuite: returns instance of custom handler
Possibly related PRs
📜 Recent review details Configuration used: CodeRabbit UI Reviewing files that changed from the base of the PR and between 4b1ec2c and 4451016. 📒 Files selected for processing (1)
packages/core/__tests__/view/Graph.test.ts (5)✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. ❤️ Share 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (.coderabbit.yaml)
Documentation and Community
|
Sorry, something went wrong.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)packages/core/__tests__/view/Graph.test.ts (1)📜 Review details215-215: Consider cleaning up registered edge styles
The tests register custom edge styles but don't unregister them afterward. While this doesn't appear to affect the current test suite (due to the isolated nature of each test), consider adding cleanup code to ensure test isolation.
test('elbow', () => { class CustomEdgeHandler extends ElbowEdgeHandler {} const edgeStyle = customEdgeStyle; EdgeStyleRegistry.add('custom', edgeStyle, { handlerKind: 'elbow' }); + afterAll(() => { + EdgeStyleRegistry.remove('custom'); + }); // ...test implementation... });Also applies to: 231-231
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Reviewing files that changed from the base of the PR and between f9d1d3d and 4b1ec2c.
📒 Files selected for processing (1)packages/core/src/index.ts (1)⏰ Context from checks skipped due to timeout of 90000ms (4)packages/core/src/view/style/edge/EdgeStyleRegistry.ts (1)
- BaseGraph (21-21)
- EdgeStyleRegistry (65-65)
packages/core/__tests__/view/Graph.test.ts (6)27-27: Appropriate import addition
Added EdgeStyleRegistry import is necessary for the new tests to register custom edge styles with specific handler kinds.
195-195: Well-named test group
The "Custom edge handler" describe block clearly indicates its purpose of testing custom edge handler functionality.
196-210: Good test for default handler customization
This test properly verifies that the graph uses a custom EdgeHandler subclass when createEdgeHandlerInstance is overridden.
Note that line 199 is commented out, which appears intentional as this test doesn't require the style to be registered with the registry (it's testing the default case).
212-226: Correct verification of elbow handler delegation
This test properly verifies that when a custom style is registered with handlerKind: 'elbow', the graph delegates to the overridden createElbowEdgeHandler method.
228-242: Correct verification of segment handler delegation
This test properly verifies that when a custom style is registered with handlerKind: 'segment', the graph delegates to the overridden createEdgeSegmentHandler method.
195-243: Good test coverage for createEdgeHandler factory method delegation
These tests effectively verify that AbstractGraph.createEdgeHandler correctly delegates to specialized factory methods based on edge style registry configuration. The tests cover both built-in edge styles (in the existing tests) and custom handler implementations (in the new tests).
The tests are well-structured with consistent patterns:
- Define a custom handler class
- Register the edge style with appropriate handler kind
- Override the appropriate factory method
- Verify the correct handler instance is created
This aligns perfectly with the PR objectives to verify factory method delegation.
Sorry, something went wrong.
|
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Add tests ensuring AbstractGraph.createEdgeHandler properly delegates to specialized factory methods
(createElbowEdgeHandler and createEdgeSegmentHandler) based on edge style registry configuration.
Tests cover both built-in edge styles and custom handler implementations.
This prepares the move of these methods to SelectionCellsHandler where they are used.
Notes
Covers #762
Summary by CodeRabbit
Summary by CodeRabbit