Skip to content

Commit e65b917

Browse files
authored
Reverted the deletion of the avatar tests (#3533)
1 parent 9e36684 commit e65b917

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import React from 'react';
2+
import {StyleSheet} from 'react-native';
3+
import {render} from '@testing-library/react-native';
4+
import {Avatar} from '../index';
5+
6+
function verifyBadgeSize(renderTree, expectedSize) {
7+
const badge = renderTree.getByTestId('avatar.onlineBadge');
8+
const style = StyleSheet.flatten(badge.props.style);
9+
expect(style.width).toEqual(expectedSize);
10+
expect(style.height).toEqual(expectedSize);
11+
}
12+
13+
describe('Avatar Badge', () => {
14+
describe('badgeProps.size supports number', () => {
15+
it('should return 99 as the size number given', () => {
16+
const renderTree = render(<Avatar testID={'avatar'} badgeProps={{size: 99}}/>);
17+
verifyBadgeSize(renderTree, 99);
18+
});
19+
20+
it('should return default when passing 0 as size', () => {
21+
const renderTree = render(<Avatar testID={'avatar'} badgeProps={{size: 0}}/>);
22+
verifyBadgeSize(renderTree, 10);
23+
});
24+
});
25+
});

0 commit comments

Comments
 (0)