Skip to content

Commit

Permalink
added test
Browse files Browse the repository at this point in the history
  • Loading branch information
Mav-Ivan committed Oct 31, 2024
1 parent ad8208b commit e4d9a28
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tests/unit/pages/chat/messages-list/MessagesList.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ vi.mock('~/components/typing-block/TypingBlock', () => ({
default: vi.fn(() => <div>Typing animation</div>)
}))

vi.spyOn(window, "getComputedStyle").mockReturnValue(new CSSStyleDeclaration)
vi.spyOn(window, 'getComputedStyle').mockReturnValue(new CSSStyleDeclaration())

global.IntersectionObserver = vi.fn().mockImplementation((callback) => ({
observe: vi.fn(),
Expand Down Expand Up @@ -78,4 +78,17 @@ describe('MessagesList component', () => {
)
expect(screen.getByText(/2024/i)).toBeInTheDocument()
})

it('loader should be render', () => {
renderWithProviders(
<MessagesList
infiniteLoadCallback={vi.fn()}
messages={[]}
isMessagesLoading={true}
/>
)
const loader = screen.getByTestId('loader')

expect(loader).toBeInTheDocument()
})
})

0 comments on commit e4d9a28

Please sign in to comment.