Repository navigation
🧪 Improve DOT extraction robustness and add unit tests - #3
Conversation
…dge cases - Modified `skills/writing-skills/render-graphs.js` to export functions and support nameless digraphs and Windows line endings. - Created `tests/writing-skills/render-graphs.test.js` with comprehensive test cases. - Improved robustness of `extractGraphBody` by using `indexOf`/`lastIndexOf` for brace matching. - Verified all tests pass in the sandbox environment. Co-authored-by: pakorn269 <[email protected]>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
There was a problem hiding this comment.
Pull request overview
This PR improves the writing-skills Graphviz rendering utility to be more testable and more robust across newline formats, and adds a small unit test suite for the parsing helpers.
Changes:
- Add a focused test file covering DOT block extraction and graph-body parsing edge cases.
- Make DOT-fence extraction work with Windows CRLF newlines.
- Refactor
render-graphs.jsto be safelyrequire()-able (guardmain()and export helper functions).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/writing-skills/render-graphs.test.js | Adds unit tests for extractDotBlocks() and extractGraphBody() (including CRLF and nested-brace cases). |
| skills/writing-skills/render-graphs.js | Improves parsing robustness, avoids running main() on import, and exports helpers for tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
🎯 What: The testing gap addressed
The
extractDotBlocksandextractGraphBodyfunctions inrender-graphs.jslacked unit tests and failed on several edge cases, including Windows-style line endings (\r\n) and nameless digraphs (e.g.,digraph { ... }), which are valid in Graphviz but were not handled correctly by the existing regex.📊 Coverage: What scenarios are now tested
```dotmarker.graph_1).rankdirattributes.✨ Result: The improvement in test coverage
A new unit test suite has been added in
tests/writing-skills/render-graphs.test.js. The core logic of the graph rendering script is now exported and testable, ensuring that future changes can be made with confidence. Bug fixes were implemented to handle a wider variety of valid Graphviz inputs and cross-platform markdown files.PR created automatically by Jules for task 14586452728125148765 started by @pakorn269