diff --git a/src/UserSearchModal.test.js b/src/UserSearchModal.test.js new file mode 100644 index 0000000..d1b09d8 --- /dev/null +++ b/src/UserSearchModal.test.js @@ -0,0 +1,27 @@ +import { screen, render } from '@folio/jest-config-stripes/testing-library/react'; + +import UserSearchModal from './UserSearchModal'; + +jest.mock('./UserSearchContainer', () => { + return jest.fn(() =>
UserSearchContainer
); +}); + +describe('UserSearchModal', () => { + it('should display search label', () => { + render(); + + expect(screen.getByText('ui-plugin-find-user.searchFieldLabel')).toBeInTheDocument(); + }); + + it('should render "UserSearchContainer"', () => { + expect(screen.getByText('UserSearchContainer')).toBeInTheDocument(); + }); + + it('close modal on clicking close button', () => { + const button = screen.getByRole('button', { name: 'Dismiss modal' }); + expect(button).toBeInTheDocument(); + + button.click(); + expect(screen.getByText('UserSearchContainer')).not.toBeInTheDocument(); + }); +});