|
| 1 | +import { render } from '@testing-library/react'; |
| 2 | + |
| 3 | +import { SearchFilterSuggestions } from './SearchFilterSuggestions'; |
| 4 | + |
| 5 | +describe('renderer/components/filters/SearchFilterSuggestions.tsx', () => { |
| 6 | + const mockOnClose = jest.fn(); |
| 7 | + |
| 8 | + it('should render itself & its children - closed', () => { |
| 9 | + const tree = render( |
| 10 | + <SearchFilterSuggestions |
| 11 | + inputValue={''} |
| 12 | + isDetailedNotificationsEnabled={false} |
| 13 | + onClose={mockOnClose} |
| 14 | + open={false} |
| 15 | + />, |
| 16 | + ); |
| 17 | + |
| 18 | + expect(tree).toMatchSnapshot(); |
| 19 | + }); |
| 20 | + |
| 21 | + it('should render itself & its children - open', () => { |
| 22 | + const tree = render( |
| 23 | + <SearchFilterSuggestions |
| 24 | + inputValue={''} |
| 25 | + isDetailedNotificationsEnabled={false} |
| 26 | + onClose={mockOnClose} |
| 27 | + open={true} |
| 28 | + />, |
| 29 | + ); |
| 30 | + |
| 31 | + expect(tree).toMatchSnapshot(); |
| 32 | + }); |
| 33 | + |
| 34 | + it('should render itself & its children - open with detailed enabled', () => { |
| 35 | + const tree = render( |
| 36 | + <SearchFilterSuggestions |
| 37 | + inputValue={''} |
| 38 | + isDetailedNotificationsEnabled={true} |
| 39 | + onClose={mockOnClose} |
| 40 | + open={true} |
| 41 | + />, |
| 42 | + ); |
| 43 | + |
| 44 | + expect(tree).toMatchSnapshot(); |
| 45 | + }); |
| 46 | + |
| 47 | + it('should render itself & its children - input token invalid', () => { |
| 48 | + const tree = render( |
| 49 | + <SearchFilterSuggestions |
| 50 | + inputValue={'invalid'} |
| 51 | + isDetailedNotificationsEnabled={false} |
| 52 | + onClose={mockOnClose} |
| 53 | + open={true} |
| 54 | + />, |
| 55 | + ); |
| 56 | + |
| 57 | + expect(tree).toMatchSnapshot(); |
| 58 | + }); |
| 59 | + |
| 60 | + it('should render itself & its children - input token valid', () => { |
| 61 | + const tree = render( |
| 62 | + <SearchFilterSuggestions |
| 63 | + inputValue={'repo:'} |
| 64 | + isDetailedNotificationsEnabled={false} |
| 65 | + onClose={mockOnClose} |
| 66 | + open={true} |
| 67 | + />, |
| 68 | + ); |
| 69 | + |
| 70 | + expect(tree).toMatchSnapshot(); |
| 71 | + }); |
| 72 | +}); |
0 commit comments