Skip to content

Commit 8e43dfc

Browse files
committed
add tests
1 parent f55faee commit 8e43dfc

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

packages/extension-chakra-store-locator/src/components/with-store-locator.test.jsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,21 @@ describe('withStoreLocator', () => {
115115
render(<WrappedComponent />)
116116
expect(screen.queryByTestId('store-locator-modal')).toBeNull()
117117
})
118+
119+
it('calls closeModal when modal is closed', () => {
120+
const TestComponent = () => <div>Test Component</div>
121+
const WrappedComponent = withStoreLocator(TestComponent, mockConfig)
122+
const mockCloseModal = jest.fn()
123+
124+
useExtensionStore.mockReturnValue({
125+
isModalOpen: true,
126+
closeModal: mockCloseModal
127+
})
128+
129+
render(<WrappedComponent />)
130+
const closeButton = screen.getByText('Close')
131+
closeButton.click()
132+
133+
expect(mockCloseModal).toHaveBeenCalled()
134+
})
118135
})

0 commit comments

Comments
 (0)