fix: PluginSlot props are now required and tests are added - #157
Conversation
📝 WalkthroughWalkthroughPluginSlot now requires a ChangesPluginSlot Props Handling
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/plugins/PluginSlot.test.jsx (1)
14-21: ⚡ Quick winAdd a regression test for omitted
propson a registered plugin.The new behavior in
PluginSlotis defaulting missingpropsto{}, but current tests only cover explicitpropsvalues.Proposed test addition
describe('PluginSlot', () => { @@ it('renders the registered component with given props', () => { const TestComponent = ({ message }) => <span>{message}</span>; TestComponent.propTypes = { message: PropTypes.string.isRequired }; act(() => registerPlugin('test-scope', TestComponent)); render(<PluginSlot scope="test-scope" props={{ message: 'hello plugin' }} />); expect(screen.getByText('hello plugin')).toBeInTheDocument(); }); + + it('does not crash when registered plugin is rendered without props', () => { + const TestComponent = () => <span>plugin without props</span>; + act(() => registerPlugin('test-scope-no-props', TestComponent)); + + expect(() => render(<PluginSlot scope="test-scope-no-props" />)).not.toThrow(); + expect(screen.getByText('plugin without props')).toBeInTheDocument(); + }); });🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/plugins/PluginSlot.test.jsx` around lines 14 - 21, Add a regression test that verifies PluginSlot defaults missing props to {} by registering a TestComponent (e.g., TestComponent used in existing test) and rendering <PluginSlot scope="test-scope" /> with no props passed; assert the component still renders (e.g., finds text or element) and does not crash — locate the registration call registerPlugin('test-scope', TestComponent) and the PluginSlot render invocation and add a new it/test case that omits the props prop to confirm the new default behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@tests/plugins/PluginSlot.test.jsx`:
- Around line 14-21: Add a regression test that verifies PluginSlot defaults
missing props to {} by registering a TestComponent (e.g., TestComponent used in
existing test) and rendering <PluginSlot scope="test-scope" /> with no props
passed; assert the component still renders (e.g., finds text or element) and
does not crash — locate the registration call registerPlugin('test-scope',
TestComponent) and the PluginSlot render invocation and add a new it/test case
that omits the props prop to confirm the new default behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 63fa63cf-d2fa-495e-a81e-671cb81c277e
📒 Files selected for processing (3)
src/plugins/PluginSlot.jsxtests/MarkerPopup/LocationDetailsBox.test.jsxtests/plugins/PluginSlot.test.jsx
|
## [1.6.1](1.6.0...1.6.1) (2026-05-13) ### Bug Fixes * PluginSlot props are now required and tests are added ([#157](#157)) ([5e6b24c](5e6b24c))
|
🎉 This PR is included in version 1.6.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |



Summary by CodeRabbit
Bug Fixes
Tests