Skip to content

Commit e578506

Browse files
bsunderhusclaude
andcommitted
test(react-overflow): fix useOverflowItem registration test
The cleanup now invokes the unregister function returned by registerItem, so the mocked registerItem must return one too (the real one always does). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 266a042 commit e578506

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

packages/react-components/react-overflow/library/src/useOverflowItem.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ const mockContextValue = (options: Partial<OverflowContextValue> = {}) =>
1717

1818
describe('useOverflowItem', () => {
1919
it('should register item', () => {
20-
const registerItemMock = jest.fn();
20+
// registerItem returns an unregister cleanup, which the hook invokes on unmount.
21+
const registerItemMock = jest.fn(() => jest.fn());
2122
const value = mockContextValue({ registerItem: registerItemMock });
2223
renderHook(
2324
() => {

0 commit comments

Comments
 (0)