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 17, 2024
1 parent 5b9be4a commit 16e1d47
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 @@ -6,7 +6,7 @@ vi.mock('~/components/message/Message', () => ({
default: vi.fn(() => <div data-testid='mock-message'>Mock Message</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 @@ -74,4 +74,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 16e1d47

Please sign in to comment.