chat-toggle-button.test.jsx 795 B

1234567891011121314151617181920212223242526
  1. import { expect } from 'chai'
  2. import { render, screen } from '@testing-library/react'
  3. import ChatToggleButton from '../../../../../frontend/js/features/editor-navigation-toolbar/components/chat-toggle-button'
  4. describe('<ChatToggleButton />', function () {
  5. const defaultProps = {
  6. chatIsOpen: false,
  7. unreadMessageCount: 0,
  8. onClick: () => {},
  9. }
  10. it('displays the number of unread messages', function () {
  11. const props = {
  12. ...defaultProps,
  13. unreadMessageCount: 113,
  14. }
  15. render(<ChatToggleButton {...props} />)
  16. screen.getByText('113')
  17. })
  18. it("doesn't display the unread messages badge when the number of unread messages is zero", function () {
  19. render(<ChatToggleButton {...defaultProps} />)
  20. expect(screen.queryByText('0')).to.not.exist
  21. })
  22. })