-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate to @testing-library/react-native #77
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -3,11 +3,9 @@ | |||||||
*/ | ||||||||
|
||||||||
import React from 'react'; | ||||||||
import ReactTestRenderer from 'react-test-renderer'; | ||||||||
import { render } from "@testing-library/react-native"; | ||||||||
import App from '../App'; | ||||||||
|
||||||||
test('renders correctly', async () => { | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test does not contain async code, so we can safely remove async keyword
Suggested change
|
||||||||
await ReactTestRenderer.act(() => { | ||||||||
ReactTestRenderer.create(<App />); | ||||||||
}); | ||||||||
render(<App />); | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All Jest test should contain some |
||||||||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
module.exports = { | ||
preset: 'react-native', | ||
setupFilesAfterEnv: ["@testing-library/react-native/extend-expect"], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd rather recommend creating |
||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,13 +24,13 @@ | |
"@react-native/eslint-config": "0.77.0-main", | ||
"@react-native/metro-config": "0.77.0-main", | ||
"@react-native/typescript-config": "0.77.0-main", | ||
"@testing-library/react-native": "^12.8.1", | ||
"@types/jest": "^29.5.13", | ||
"@types/react": "^18.2.6", | ||
"@types/react-test-renderer": "^18.0.0", | ||
"eslint": "^8.19.0", | ||
"jest": "^29.6.3", | ||
"prettier": "2.8.8", | ||
"react-test-renderer": "19.0.0-rc-fb9a90fa48-20240614", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should not remove |
||
"typescript": "5.0.4" | ||
}, | ||
"engines": { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.