verdnatura-chat/__tests__/RoomItem.js

33 lines
1.0 KiB
JavaScript
Raw Normal View History

import 'react-native';
import React from 'react';
import RoomItem from '../app/components/RoomItem';
// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer';
2017-08-22 12:01:53 +00:00
jest.mock('react-native-img-cache', () => { return { CachedImage: 'View' } });
it('renders correctly', () => {
2017-08-22 12:01:53 +00:00
expect(renderer.create(<RoomItem type="d" name="name" />).toJSON()).toMatchSnapshot();
});
it('render unread', () => {
2017-08-22 12:01:53 +00:00
expect(renderer.create(<RoomItem type="d" name="name" unread={1} />).toJSON()).toMatchSnapshot();
});
it('render unread +999', () => {
2017-08-22 12:01:53 +00:00
expect(renderer.create(<RoomItem type="d" name="name" unread={1000} />).toJSON()).toMatchSnapshot();
});
2017-08-22 18:22:55 +00:00
it('render no icon', () => {
expect(renderer.create(<RoomItem type="X" name="name" />).toJSON()).toMatchSnapshot();
});
it('render private group', () => {
expect(renderer.create(<RoomItem type="g" name="private-group" /> ).toJSON()).toMatchSnapshot();
});
it('render channel', () => {
expect(renderer.create(<RoomItem type="c" name="general" />).toJSON()).toMatchSnapshot();
});