-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add jest tests and run it on workflow
- Loading branch information
Showing
12 changed files
with
294 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Jest on CI | ||
|
||
on: | ||
push: | ||
branches: main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install dependecies | ||
run: npm ci | ||
|
||
- name: Run test | ||
run: npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module.exports = { | ||
presets: ['module:@react-native/babel-preset'], | ||
presets: ['module:@react-native/babel-preset', '@babel/preset-typescript'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import '@testing-library/react-native/extend-expect'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
module.exports = { | ||
preset: 'react-native', | ||
setupFilesAfterEnv: ['<rootDir>/jest-setup.js'], | ||
testMatch: ['<rootDir>/src/**/*.test.ts?(x)'], | ||
transformIgnorePatterns: [ | ||
'node_modules/(?!(jest-)?react-native|react-clone-referenced-element|@react-native-community|rollbar-react-native|@react-native|@react-navigation)', | ||
], | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
133 changes: 133 additions & 0 deletions
133
src/components/weather-row/__snapshots__/weather.test.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Weather row should render correctly 1`] = ` | ||
<View | ||
accessibilityState={ | ||
{ | ||
"busy": undefined, | ||
"checked": undefined, | ||
"disabled": undefined, | ||
"expanded": undefined, | ||
"selected": undefined, | ||
} | ||
} | ||
accessibilityValue={ | ||
{ | ||
"max": undefined, | ||
"min": undefined, | ||
"now": undefined, | ||
"text": undefined, | ||
} | ||
} | ||
accessible={true} | ||
collapsable={false} | ||
focusable={true} | ||
onClick={[Function]} | ||
onResponderGrant={[Function]} | ||
onResponderMove={[Function]} | ||
onResponderRelease={[Function]} | ||
onResponderTerminate={[Function]} | ||
onResponderTerminationRequest={[Function]} | ||
onStartShouldSetResponder={[Function]} | ||
style={ | ||
{ | ||
"borderBottomWidth": 1, | ||
"borderColor": "#ddd", | ||
"marginBottom": 10, | ||
"opacity": 1, | ||
"paddingBottom": 10, | ||
"paddingHorizontal": 10, | ||
} | ||
} | ||
testID="wheather-row" | ||
> | ||
<View | ||
style={ | ||
{ | ||
"alignItems": "center", | ||
"flex": 1, | ||
"flexDirection": "row", | ||
"gap": 16, | ||
} | ||
} | ||
> | ||
<View | ||
style={ | ||
{ | ||
"height": 50, | ||
"position": "relative", | ||
"width": 80, | ||
} | ||
} | ||
> | ||
<Image | ||
height={50} | ||
source={ | ||
{ | ||
"uri": "https://openweathermap.org/img/wn/[email protected]", | ||
} | ||
} | ||
style={ | ||
{ | ||
"left": 0, | ||
"position": "absolute", | ||
"top": 0, | ||
} | ||
} | ||
width={50} | ||
/> | ||
</View> | ||
<View | ||
style={ | ||
{ | ||
"alignItems": "center", | ||
"flex": 1, | ||
"flexDirection": "column", | ||
} | ||
} | ||
> | ||
<Text | ||
style={ | ||
{ | ||
"fontWeight": "600", | ||
} | ||
} | ||
testID="cityName" | ||
> | ||
Gothem | ||
</Text> | ||
<Text | ||
style={ | ||
{ | ||
"fontWeight": "300", | ||
} | ||
} | ||
> | ||
snow | ||
</Text> | ||
</View> | ||
<View | ||
style={ | ||
{ | ||
"backgroundColor": "#9c3a5f", | ||
"borderRadius": 50, | ||
"padding": 8, | ||
} | ||
} | ||
> | ||
<Text | ||
style={ | ||
{ | ||
"color": "#fff", | ||
} | ||
} | ||
> | ||
100 F | ||
</Text> | ||
</View> | ||
<Text> | ||
> | ||
</Text> | ||
</View> | ||
</View> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.