Reduce test lines of code
This commit is contained in:
parent
9dc427c336
commit
43ab17d507
|
@ -5,70 +5,16 @@ import RoomItem from '../app/components/RoomItem';
|
||||||
// Note: test renderer must be required after react-native.
|
// Note: test renderer must be required after react-native.
|
||||||
import renderer from 'react-test-renderer';
|
import renderer from 'react-test-renderer';
|
||||||
|
|
||||||
jest.mock('react-native-img-cache', () => {
|
jest.mock('react-native-img-cache', () => { return { CachedImage: 'View' } });
|
||||||
return {
|
|
||||||
CachedImage: 'View'
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
it('renders correctly', () => {
|
it('renders correctly', () => {
|
||||||
const tree = renderer.create(
|
expect(renderer.create(<RoomItem type="d" name="name" />).toJSON()).toMatchSnapshot();
|
||||||
<RoomItem
|
|
||||||
type="d"
|
|
||||||
name="name"
|
|
||||||
/>
|
|
||||||
).toJSON();
|
|
||||||
expect(tree).toMatchSnapshot();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('render unread', () => {
|
it('render unread', () => {
|
||||||
const tree = renderer.create(
|
expect(renderer.create(<RoomItem type="d" name="name" unread={1} />).toJSON()).toMatchSnapshot();
|
||||||
<RoomItem
|
|
||||||
type="d"
|
|
||||||
name="name"
|
|
||||||
unread={1}
|
|
||||||
/>
|
|
||||||
).toJSON();
|
|
||||||
expect(tree).toMatchSnapshot();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('render unread +999', () => {
|
it('render unread +999', () => {
|
||||||
const tree = renderer.create(
|
expect(renderer.create(<RoomItem type="d" name="name" unread={1000} />).toJSON()).toMatchSnapshot();
|
||||||
<RoomItem
|
|
||||||
type="d"
|
|
||||||
name="name"
|
|
||||||
unread={1000}
|
|
||||||
/>
|
|
||||||
).toJSON();
|
|
||||||
expect(tree).toMatchSnapshot();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('render no icon', () => {
|
|
||||||
const tree = renderer.create(
|
|
||||||
<RoomItem
|
|
||||||
type="X"
|
|
||||||
name="name"
|
|
||||||
/>
|
|
||||||
).toJSON();
|
|
||||||
expect(tree).toMatchSnapshot();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('render private group', () => {
|
|
||||||
const tree = renderer.create(
|
|
||||||
<RoomItem
|
|
||||||
type="g"
|
|
||||||
name="private-group"
|
|
||||||
/>
|
|
||||||
).toJSON();
|
|
||||||
expect(tree).toMatchSnapshot();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('render channel', () => {
|
|
||||||
const tree = renderer.create(
|
|
||||||
<RoomItem
|
|
||||||
type="c"
|
|
||||||
name="general"
|
|
||||||
/>
|
|
||||||
).toJSON();
|
|
||||||
expect(tree).toMatchSnapshot();
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue