|
| 1 | +import { renderWithAppContext } from '../../__helpers__/test-utils'; |
| 2 | +import { mockGitifyNotification } from '../../__mocks__/notifications-mocks'; |
| 3 | + |
| 4 | +import { CommentsPill } from './CommentsPill'; |
| 5 | + |
| 6 | +describe('renderer/components/metrics/CommentsPill.tsx', () => { |
| 7 | + it('renders with no comments (null)', () => { |
| 8 | + const mockNotification = { ...mockGitifyNotification }; |
| 9 | + mockNotification.subject.commentCount = null; |
| 10 | + |
| 11 | + const tree = renderWithAppContext( |
| 12 | + <CommentsPill commentCount={mockNotification.subject.commentCount} />, |
| 13 | + ); |
| 14 | + |
| 15 | + expect(tree).toMatchSnapshot(); |
| 16 | + }); |
| 17 | + |
| 18 | + it('renders with 1 comment', () => { |
| 19 | + const mockNotification = { ...mockGitifyNotification }; |
| 20 | + mockNotification.subject.commentCount = 1; |
| 21 | + |
| 22 | + const tree = renderWithAppContext( |
| 23 | + <CommentsPill commentCount={mockNotification.subject.commentCount} />, |
| 24 | + ); |
| 25 | + |
| 26 | + expect(tree).toMatchSnapshot(); |
| 27 | + }); |
| 28 | + |
| 29 | + it('renders with multiple comments', () => { |
| 30 | + const mockNotification = { ...mockGitifyNotification }; |
| 31 | + mockNotification.subject.commentCount = 2; |
| 32 | + |
| 33 | + const tree = renderWithAppContext( |
| 34 | + <CommentsPill commentCount={mockNotification.subject.commentCount} />, |
| 35 | + ); |
| 36 | + |
| 37 | + expect(tree).toMatchSnapshot(); |
| 38 | + }); |
| 39 | +}); |
0 commit comments