-
Notifications
You must be signed in to change notification settings - Fork 298
Expand file tree
/
Copy pathEmptyStateIndicator.test.js
More file actions
45 lines (37 loc) · 1.44 KB
/
EmptyStateIndicator.test.js
File metadata and controls
45 lines (37 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import React from 'react';
import { cleanup, render, screen } from '@testing-library/react';
import '@testing-library/jest-dom';
import { EmptyStateIndicator } from '../EmptyStateIndicator';
afterEach(cleanup);
describe('EmptyStateIndicator', () => {
it('should render with default props', () => {
jest.spyOn(console, 'error').mockImplementationOnce(() => null);
const { container } = render(<EmptyStateIndicator />);
expect(container).toMatchInlineSnapshot(`
<div>
<p>
No items exist
</p>
</div>
`);
});
it('should display correct text when listType is message', () => {
render(<EmptyStateIndicator listType='message' />);
expect(
screen.queryByText('Send a message to start the conversation'),
).toBeInTheDocument();
});
it('should display correct text when listType is channel', () => {
render(<EmptyStateIndicator listType='channel' />);
expect(screen.queryByText('You have no channels currently')).toBeInTheDocument();
});
it('should return null if listType is thread', () => {
const { container } = render(<EmptyStateIndicator listType='thread' />);
expect(container).toBeEmptyDOMElement();
});
it('should display correct text when no listType is provided', () => {
jest.spyOn(console, 'error').mockImplementationOnce(() => null);
render(<EmptyStateIndicator />);
expect(screen.getByText('No items exist')).toBeInTheDocument();
});
});