12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- import {mountWithTheme} from 'sentry-test/enzyme';
- import SeenByList from 'app/components/seenByList';
- import ConfigStore from 'app/stores/configStore';
- describe('SeenByList', function () {
- beforeEach(function () {
- jest.spyOn(ConfigStore, 'get').mockImplementation(() => ({}));
- });
- afterEach(function () {});
- it('should return null if seenBy is falsy', function () {
- const wrapper = mountWithTheme(<SeenByList />);
- expect(wrapper.children()).toHaveLength(0);
- });
- it('should return a list of each user that saw', function () {
- const wrapper = mountWithTheme(
- <SeenByList
- seenBy={[
- {id: '1', email: 'jane@example.com'},
- {id: '2', email: 'john@example.com'},
- ]}
- />
- );
- expect(wrapper.find('IconShow')).toHaveLength(1);
- expect(wrapper.find('AvatarList')).toHaveLength(1);
- expect(wrapper.find('UserAvatar')).toHaveLength(2);
- });
- it('filters out the current user from list of users', function () {
- jest
- .spyOn(ConfigStore, 'get')
- .mockImplementation(() => ({id: '1', email: 'jane@example.com'}));
- const wrapper = mountWithTheme(
- <SeenByList
- seenBy={[
- {id: '1', email: 'jane@example.com'},
- {id: '2', email: 'john@example.com'},
- ]}
- />
- );
- expect(wrapper.find('IconShow')).toHaveLength(1);
- expect(wrapper.find('AvatarList')).toHaveLength(1);
- expect(wrapper.find('UserAvatar')).toHaveLength(1);
- expect(wrapper.find('LetterAvatar').prop('displayName')).toBe('john@example.com');
- });
- });
|