File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
src/components/avatar/__tests__ Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change
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
+ } ) ;
You can’t perform that action at this time.
0 commit comments