Skip to content

feat(layout): implement unit tests for circular layout#254

Merged
yvonneyx merged 6 commits into
v5from
chore--circular
Nov 11, 2025
Merged

feat(layout): implement unit tests for circular layout#254
yvonneyx merged 6 commits into
v5from
chore--circular

Conversation

@yvonneyx

Copy link
Copy Markdown
Collaborator
  • Add unit tests for circular layout
  • API Reference

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @yvonneyx, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the circular layout functionality by introducing a robust suite of unit tests and comprehensive API documentation. The changes ensure the layout algorithm behaves as expected across diverse scenarios and provide clear guidance for its usage. Additionally, several utility functions received dedicated test coverage, and the testing infrastructure was refined for better maintainability and reporting.

Highlights

  • Comprehensive Unit Tests for Circular Layout: Added extensive unit tests for the circular layout algorithm, covering various configurations such as custom radius, angle ranges, clockwise/counterclockwise settings, divisions, custom center points, and handling of single-node or empty graphs. Tests also include different node ordering methods like degree, topology, topology-directed, and original order.
  • Detailed API Reference Documentation: Introduced a new API reference document for the Circular layout, providing clear usage instructions, a comprehensive list of configurable options, and explanations of different layout types (Circle, Spiral, Multi-Division) and node ordering strategies.
  • New Utility Function Tests: Added new unit test files for several utility functions, including isArray, handleSingleNodeGraph, formatNumberFn, formatSizeFn, formatNodeSizeToNumber, clone, and cloneFormatData, ensuring their correctness and reliability.
  • Updated Testing Infrastructure: Refactored testing utilities, including renaming createGraphCanvas to createCanvas and enhancing rendering functions to support displaying edges and node labels in snapshots. Jest configuration was updated to enable coverage collection.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request significantly improves the testing for the circular layout by adding a comprehensive suite of unit tests and snapshot tests. It also adds API documentation for the circular layout, which is a great addition for users. The refactoring of test utilities and project configuration also improves the development experience.

I've found a few minor issues in the new documentation and a missing test case that would uncover a bug in the layout logic. My comments provide suggestions to address these points. Overall, this is a great contribution to improve the quality and usability of the circular layout.

Comment thread packages/layout/__tests__/unit/circular.test.ts
Comment thread docs/api/circular.md Outdated
Comment thread docs/api/circular.md
| startAngle | The start angle in radians for placing nodes. | `number` | `0` |
| endAngle | The end angle in radians for placing nodes. | `number` | `2 * Math.PI` |
| clockwise | Whether to place nodes in clockwise order. | `boolean` | `true` |
| divisions | The division number of nodes on the circle. Takes effect when `endRadius - startRadius !== 0`. | `number` | `1` |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The description for the divisions option states that it "Takes effect when endRadius - startRadius !== 0". This seems to be incorrect. Based on the implementation, divisions are used to partition the circle into sectors and this logic is applied regardless of whether it's a spiral layout or a simple circle layout. This condition should be removed to avoid confusion.

@yvonneyx yvonneyx force-pushed the chore--circular branch 2 times, most recently from 94ba007 to 59fddfd Compare November 11, 2025 06:53
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@codecov-commenter

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@yvonneyx yvonneyx moved this from Backlog to In review in 🧱 Layout 2.0 Nov 11, 2025
@yvonneyx yvonneyx changed the title feat: implement unit tests for circular layout feat(layout): implement unit tests for circular layout Nov 11, 2025
@yvonneyx yvonneyx merged commit dc92f81 into v5 Nov 11, 2025
2 checks passed
@yvonneyx yvonneyx deleted the chore--circular branch November 11, 2025 07:53
@github-project-automation github-project-automation Bot moved this from In review to Done in 🧱 Layout 2.0 Nov 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants