Skip to content

Fix: reset mocks between renders in spacing migration tests#2183

Merged
pedrobonamin merged 2 commits intoprops-deprecation-warningsfrom
copilot/sub-pr-2182
Mar 17, 2026
Merged

Fix: reset mocks between renders in spacing migration tests#2183
pedrobonamin merged 2 commits intoprops-deprecation-warningsfrom
copilot/sub-pr-2182

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 16, 2026

Spacing migration tests (spacegap, columnsgridTemplateColumns, rowsgridTemplateRows) were not clearing mocks between the two renders within a single test case. The beforeEach only clears between test cases — within a test, accumulated call history meant the second assertion (for the new prop) could pass vacuously from the first render's calls, providing no real coverage.

Fix

Added mockClear() between the legacy-prop render and the new-prop render in all 13 affected test files:

  • select, inline, stack, textInput, grid (×2: columns + rows)
  • tree, treeItem, tabList
  • menu.spacing, menuItem.spacing, menuGroup.spacing, hotkeys, breadcrumbs
it('should support `space` and `gap` with the same behavior', () => {
  render(<Stack space={2}>...</Stack>)
  expect(mockedFn).toHaveBeenCalledWith(expect.objectContaining({$space: [2]}))

  mockedFn.mockClear() // ← added: ensures the next assertion is not a ghost pass
  render(<Stack gap={2}>...</Stack>)
  expect(mockedFn).toHaveBeenCalledWith(expect.objectContaining({$space: [2]}))
})

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 16, 2026

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

Project Deployment Actions Updated (UTC)
sanity-ui-storybook Ready Ready Preview Mar 16, 2026 3:49pm
sanity-ui-workshop Ready Ready Preview, Comment Mar 16, 2026 3:49pm

Request Review

Co-authored-by: pedrobonamin <46196328+pedrobonamin@users.noreply.github.com>
Copy link
Copy Markdown
Author

Copilot AI commented Mar 16, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • download.cypress.io
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node index.js --exec install osti�� (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Fix props deprecation warnings Fix: reset mocks between renders in spacing migration tests Mar 16, 2026
Copilot AI requested a review from pedrobonamin March 16, 2026 15:48
@pedrobonamin pedrobonamin marked this pull request as ready for review March 17, 2026 10:32
@pedrobonamin pedrobonamin merged commit b18e260 into props-deprecation-warnings Mar 17, 2026
9 checks passed
@pedrobonamin pedrobonamin deleted the copilot/sub-pr-2182 branch March 17, 2026 10:33
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.

2 participants