overleaf-cep/services/web/test/frontend/features/editor-navigation-toolbar/components/chat-toggle-button.test.tsx
Antoine Clausse 07b1701b72 [web] Convert EditorProviders and some test files to Typescript (#26512)
* Rename files to tsx

* Update types

* Remove props that aren't typed

* Add `LayoutContextOwnStates`

* Use `LayoutContextOwnStates`

* Ignore ts errors about `SocketIOMock`

* Address comments: remove `satisfies`, update `BroadcastChannel` fixture

* Add types to `makeEditorOpenDocProvider`. Update `openDocId`->`currentDocumentId`

* misc.

* Type sockets as `SocketIOMock & Socket`

* Fix remaining typing errors

* Fix type of `ideReactContextValue`

GitOrigin-RevId: 2734ac707517d56c452b0bf06ea3438f947a64be
2025-07-07 08:05:40 +00:00

26 lines
795 B
TypeScript

import { expect } from 'chai'
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
})
})