forked from webex/widgets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtask-list.presentational.tsx
54 lines (49 loc) · 1.57 KB
/
task-list.presentational.tsx
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
46
47
48
49
50
51
52
53
54
import React from 'react';
import {render, screen, cleanup} from '@testing-library/react';
import '@testing-library/jest-dom';
import TaskListPresentational from '../../src/TaskList/task-list.presentational';
import {TaskListPresentationalProps} from '../../src/task.types';
jest.mock('@momentum-ui/react-collaboration', () => ({
ButtonPill: () => <div data-testid="ButtonPill" />,
ListItemBase: () => <div data-testid="ListItemBase" />,
ListItemBaseSection: () => <div data-testid="ListItemBaseSection" />,
Text: () => <div data-testid="Text" />,
}));
jest.mock('@momentum-design/components/dist/react', () => ({
Avatar: () => <div data-testid="Avatar" />,
}));
describe('TaskListPresentational Component', () => {
afterEach(cleanup);
it('renders a list of tasks when taskList is not empty', () => {
const props: TaskListPresentationalProps = {
taskList: [
{
id: '1',
data: {
interaction: {
callAssociatedDetails: {
ani: '1234567890',
dn: '9876543210',
virtualTeamName: 'Sales Team',
},
},
},
},
{
id: '2',
data: {
interaction: {
callAssociatedDetails: {
ani: '0987654321',
dn: '8765432109',
virtualTeamName: 'Support Team',
},
},
},
},
],
};
render(<TaskListPresentational {...props} />);
expect(screen.getAllByTestId('ListItemBase')).toHaveLength(2);
});
});