Skip to content

Conversation

@araujogui
Copy link
Member

Description

Create some tests for remark table plguin

Validation

pnpm test

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run pnpm format to ensure the code follows the style guide.
  • I have run pnpm test to check if all tests are passing.
  • I have run pnpm build to check if the website builds without errors.
  • I've covered new added functionality with unit tests if necessary.

@araujogui araujogui requested a review from a team as a code owner October 30, 2025 23:09
Copilot AI review requested due to automatic review settings October 30, 2025 23:09
@vercel
Copy link

vercel bot commented Oct 30, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
nodejs-org Ready Ready Preview Oct 30, 2025 11:10pm

@codecov
Copy link

codecov bot commented Oct 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.66%. Comparing base (04bbc56) to head (300ee60).
⚠️ Report is 17 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8295      +/-   ##
==========================================
+ Coverage   76.53%   76.66%   +0.13%     
==========================================
  Files         117      118       +1     
  Lines        9733     9793      +60     
  Branches      329      335       +6     
==========================================
+ Hits         7449     7508      +59     
- Misses       2282     2283       +1     
  Partials        2        2              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a bug in the table cell boundary check and moves the cell.data initialization to occur after the boundary check instead of before. The changes ensure that cells with indices beyond the header columns are properly handled without unnecessary data initialization.

  • Fixed the boundary condition from idx > headerLabels.length to idx > headerLabels.length - 1 to correctly identify cells beyond header bounds
  • Moved cell.data ??= {} initialization to occur after the boundary check to avoid initializing data for out-of-bounds cells
  • Added comprehensive test suite covering various edge cases including extra columns, complex headers, and empty cells

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
apps/site/util/table.ts Fixed boundary check logic and reordered cell.data initialization to happen after validation
apps/site/util/tests/table.test.mjs Added comprehensive test suite with 8 test cases covering normal operation and edge cases
Comments suppressed due to low confidence (1)

apps/site/util/table.ts:42

  • Direct assignment to cell.data.hProperties will overwrite any existing properties. The test case 'should preserve existing cell data and merge with new hProperties' expects existing hProperties (like className: 'existing-class') to be preserved, but this assignment will replace them. Use object spread to merge: cell.data.hProperties = { ...cell.data.hProperties, 'data-label': headerLabels[idx] };
          cell.data.hProperties = {
            'data-label': headerLabels[idx],
          };

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@AugustinMauroy AugustinMauroy left a comment

Choose a reason for hiding this comment

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

Clean

@avivkeller avivkeller added this pull request to the merge queue Nov 2, 2025
Merged via the queue into nodejs:main with commit f58851b Nov 2, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants