overleaf/services/web/test/frontend/features/editor-navigation-toolbar/components/chat-toggle-button.test.js
Miguel Serrano 1d4c7f71d5 Merge pull request #4010 from overleaf/msm-navbar-tests
Added tests for navbar chat button and project name

GitOrigin-RevId: fc33142ef80254d65505c2b623ac768f8a4dfdf2
2021-05-14 02:09:41 +00:00

27 lines
821 B
JavaScript

import { expect } from 'chai'
import React from 'react'
import { render, screen } from '@testing-library/react'
import ChatToggleButton from '../../../../../frontend/js/features/editor-navigation-toolbar/components/chat-toggle-button'
describe('<ChatToggleButton />', function () {
const defaultProps = {
chatIsOpen: false,
unreadMessageCount: 0,
onClick: () => {},
}
it('displays the number of unread messages', function () {
const props = {
...defaultProps,
unreadMessageCount: 113,
}
render(<ChatToggleButton {...props} />)
screen.getByText('113')
})
it("doesn't display the unread messages badge when the number of unread messages is zero", function () {
render(<ChatToggleButton {...defaultProps} />)
expect(screen.queryByText('0')).to.not.exist
})
})