Skip to content

Commit

Permalink
Adjusted unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
musidlo committed Dec 23, 2024
1 parent 5a9bb49 commit 010c034
Show file tree
Hide file tree
Showing 3 changed files with 129 additions and 35 deletions.
152 changes: 120 additions & 32 deletions packages/app/features/profile/__snapshots__/screen.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,15 @@ exports[`ProfileScreen: ProfileScreen 1`] = `
}
>
<View
cancelable={[Function]}
disabled={false}
focusable={[Function]}
minPressDuration={0}
onMouseEnter={[Function]}
onMouseLeave={[Function]}
onPress={[Function]}
onPressIn={[Function]}
onPressOut={[Function]}
style={
{
"alignItems": "center",
Expand All @@ -101,11 +110,8 @@ exports[`ProfileScreen: ProfileScreen 1`] = `
"borderTopLeftRadius": 9,
"borderTopRightRadius": 9,
"flexDirection": "column",
"gap": 7,
"height": 64,
"justifyContent": "center",
"marginLeft": "none",
"marginRight": "none",
"maxHeight": 64,
"maxWidth": 64,
"minHeight": 64,
Expand All @@ -115,7 +121,6 @@ exports[`ProfileScreen: ProfileScreen 1`] = `
"width": 64,
}
}
testID="avatar"
>
<View
style={
Expand Down Expand Up @@ -154,10 +159,7 @@ exports[`ProfileScreen: ProfileScreen 1`] = `
<View
style={
{
"alignItems": "center",
"backgroundColor": "#111f22",
"bottom": 0,
"flex": 1,
"flexDirection": "column",
"justifyContent": "center",
"left": 0,
Expand All @@ -168,20 +170,64 @@ exports[`ProfileScreen: ProfileScreen 1`] = `
}
}
>
<Text
<RNSVGSvgView
align="xMidYMid"
bbHeight={64}
bbWidth={64}
color="#86AE80"
fill="none"
focusable={false}
height={64}
meetOrSlice={0}
minX={0}
minY={0}
strokeWidth="2"
style={
{
"color": "#FFFFFF",
"fontFamily": "System",
"fontSize": 74.39999999999999,
"fontWeight": "600",
"lineHeight": 67,
}
[
{
"backgroundColor": "transparent",
"borderWidth": 0,
},
{
"color": "#86AE80",
},
{
"flex": 0,
"height": 64,
"width": 64,
},
]
}
suppressHighlighting={true}
tintColor="#86AE80"
vbHeight={20}
vbWidth={20}
width={64}
>
??
</Text>
<RNSVGGroup
fill={null}
propList={
[
"fill",
"strokeWidth",
]
}
strokeWidth="2"
>
<RNSVGPath
d="M9.99967 9.97913C9.08301 9.97913 8.33301 9.68746 7.74967 9.10413C7.16634 8.52079 6.87467 7.77079 6.87467 6.85413C6.87467 5.93746 7.16634 5.18746 7.74967 4.60413C8.33301 4.02079 9.08301 3.72913 9.99967 3.72913C10.9163 3.72913 11.6663 4.02079 12.2497 4.60413C12.833 5.18746 13.1247 5.93746 13.1247 6.85413C13.1247 7.77079 12.833 8.52079 12.2497 9.10413C11.6663 9.68746 10.9163 9.97913 9.99967 9.97913ZM3.33301 16.6666V14.7083C3.33301 14.1805 3.46495 13.7291 3.72884 13.3541C3.99273 12.9791 4.33301 12.6944 4.74967 12.5C5.68023 12.0833 6.57259 11.7708 7.42676 11.5625C8.28092 11.3541 9.13856 11.25 9.99967 11.25C10.8608 11.25 11.715 11.3576 12.5622 11.5729C13.4094 11.7882 14.2977 12.0985 15.2272 12.504C15.6619 12.7002 16.0105 12.9847 16.2728 13.3575C16.5352 13.7302 16.6663 14.1805 16.6663 14.7083V16.6666H3.33301ZM4.58301 15.4166H15.4163V14.7083C15.4163 14.4861 15.3504 14.2743 15.2184 14.0729C15.0865 13.8715 14.9233 13.7222 14.7288 13.625C13.84 13.1944 13.0275 12.8993 12.2913 12.7395C11.5552 12.5798 10.7913 12.5 9.99967 12.5C9.20801 12.5 8.43717 12.5798 7.68717 12.7395C6.93717 12.8993 6.12467 13.1944 5.24967 13.625C5.05523 13.7222 4.89551 13.8715 4.77051 14.0729C4.64551 14.2743 4.58301 14.4861 4.58301 14.7083V15.4166ZM9.99967 8.72913C10.5413 8.72913 10.9893 8.55204 11.3434 8.19788C11.6976 7.84371 11.8747 7.39579 11.8747 6.85413C11.8747 6.31246 11.6976 5.86454 11.3434 5.51038C10.9893 5.15621 10.5413 4.97913 9.99967 4.97913C9.45801 4.97913 9.01009 5.15621 8.65592 5.51038C8.30176 5.86454 8.12467 6.31246 8.12467 6.85413C8.12467 7.39579 8.30176 7.84371 8.65592 8.19788C9.01009 8.55204 9.45801 8.72913 9.99967 8.72913Z"
fill={
{
"type": 2,
}
}
propList={
[
"fill",
]
}
/>
</RNSVGGroup>
</RNSVGSvgView>
</View>
</View>
<Text
Expand Down Expand Up @@ -409,7 +455,7 @@ exports[`ProfileScreen: ProfileScreen 1`] = `
onLoad={[Function]}
source={
{
"uri": "https://ui-avatars.com/api.jpg?name=??&size=256",
"uri": "",
}
}
style={
Expand All @@ -425,9 +471,7 @@ exports[`ProfileScreen: ProfileScreen 1`] = `
style={
{
"alignItems": "center",
"backgroundColor": "#111f22",
"bottom": 0,
"flex": 1,
"flexDirection": "column",
"justifyContent": "center",
"left": 0,
Expand All @@ -438,20 +482,64 @@ exports[`ProfileScreen: ProfileScreen 1`] = `
}
}
>
<Text
<RNSVGSvgView
align="xMidYMid"
bbHeight={64}
bbWidth={64}
color="#86AE80"
fill="none"
focusable={false}
height={64}
meetOrSlice={0}
minX={0}
minY={0}
strokeWidth="2"
style={
{
"color": "#FFFFFF",
"fontFamily": "System",
"fontSize": 74.39999999999999,
"fontWeight": "600",
"lineHeight": 67,
}
[
{
"backgroundColor": "transparent",
"borderWidth": 0,
},
{
"color": "#86AE80",
},
{
"flex": 0,
"height": 64,
"width": 64,
},
]
}
suppressHighlighting={true}
tintColor="#86AE80"
vbHeight={20}
vbWidth={20}
width={64}
>
??
</Text>
<RNSVGGroup
fill={null}
propList={
[
"fill",
"strokeWidth",
]
}
strokeWidth="2"
>
<RNSVGPath
d="M9.99967 9.97913C9.08301 9.97913 8.33301 9.68746 7.74967 9.10413C7.16634 8.52079 6.87467 7.77079 6.87467 6.85413C6.87467 5.93746 7.16634 5.18746 7.74967 4.60413C8.33301 4.02079 9.08301 3.72913 9.99967 3.72913C10.9163 3.72913 11.6663 4.02079 12.2497 4.60413C12.833 5.18746 13.1247 5.93746 13.1247 6.85413C13.1247 7.77079 12.833 8.52079 12.2497 9.10413C11.6663 9.68746 10.9163 9.97913 9.99967 9.97913ZM3.33301 16.6666V14.7083C3.33301 14.1805 3.46495 13.7291 3.72884 13.3541C3.99273 12.9791 4.33301 12.6944 4.74967 12.5C5.68023 12.0833 6.57259 11.7708 7.42676 11.5625C8.28092 11.3541 9.13856 11.25 9.99967 11.25C10.8608 11.25 11.715 11.3576 12.5622 11.5729C13.4094 11.7882 14.2977 12.0985 15.2272 12.504C15.6619 12.7002 16.0105 12.9847 16.2728 13.3575C16.5352 13.7302 16.6663 14.1805 16.6663 14.7083V16.6666H3.33301ZM4.58301 15.4166H15.4163V14.7083C15.4163 14.4861 15.3504 14.2743 15.2184 14.0729C15.0865 13.8715 14.9233 13.7222 14.7288 13.625C13.84 13.1944 13.0275 12.8993 12.2913 12.7395C11.5552 12.5798 10.7913 12.5 9.99967 12.5C9.20801 12.5 8.43717 12.5798 7.68717 12.7395C6.93717 12.8993 6.12467 13.1944 5.24967 13.625C5.05523 13.7222 4.89551 13.8715 4.77051 14.0729C4.64551 14.2743 4.58301 14.4861 4.58301 14.7083V15.4166ZM9.99967 8.72913C10.5413 8.72913 10.9893 8.55204 11.3434 8.19788C11.6976 7.84371 11.8747 7.39579 11.8747 6.85413C11.8747 6.31246 11.6976 5.86454 11.3434 5.51038C10.9893 5.15621 10.5413 4.97913 9.99967 4.97913C9.45801 4.97913 9.01009 5.15621 8.65592 5.51038C8.30176 5.86454 8.12467 6.31246 8.12467 6.85413C8.12467 7.39579 8.30176 7.84371 8.65592 8.19788C9.01009 8.55204 9.45801 8.72913 9.99967 8.72913Z"
fill={
{
"type": 2,
}
}
propList={
[
"fill",
]
}
/>
</RNSVGGroup>
</RNSVGSvgView>
</View>
</View>
<View
Expand Down
8 changes: 7 additions & 1 deletion packages/app/features/profile/components/ProfileHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,13 @@ export const ProfileHeader = ({
e.stopPropagation()
}}
>
<Avatar.Image src={profile?.avatar_url ?? ''} />
<Avatar.Image
src={profile?.avatar_url ?? ''}
testID="avatarImage"
accessibilityLabel={profile?.name ?? '??'}
accessibilityRole="image"
accessible
/>
<Avatar.Fallback jc="center">
<IconAccount size="$6" color="$olive" />
</Avatar.Fallback>
Expand Down
4 changes: 2 additions & 2 deletions packages/app/features/profile/screen.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ test('ProfileScreen', async () => {

const h1 = screen.getByText(PROFILE.name)
expect(h1).toBeOnTheScreen()
const avatars = screen.getAllByTestId('avatar')
expect(avatars.length).toBe(2)
const avatar = screen.getByTestId('avatar')
expect(avatar).toBeOnTheScreen()
const image = screen.getByRole('image', { name: PROFILE.name })
expect(image).toBeOnTheScreen()
expect(image.props.source).toStrictEqual({
Expand Down

0 comments on commit 010c034

Please sign in to comment.