-
Notifications
You must be signed in to change notification settings - Fork 783
test: Add RepositoryProfile tests #531
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
Conversation
- Add tests for Repository Profile Component - Mock ‘react-native-safari-view’
@@ -164,13 +164,17 @@ export const RepositoryProfile = ({ | |||
</Text> | |||
|
|||
{repository.fork && ( | |||
<Text style={[styles.subtitle, styles.subtitleFork]}> | |||
<Text | |||
nativeId="repository-fork-container" |
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.
I had to add this prop so it was possible to target this specific component in its test file.
nativeId
is used for e2e tests Docs About nativeId
@@ -29,3 +29,5 @@ jest.mock('react-native-i18n', () => { | |||
jest.mock('react-native-cookies', () => ({})); | |||
|
|||
jest.mock('react-native-code-push', () => ({})); | |||
|
|||
jest.mock('react-native-safari-view', () => ({})); |
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.
Mocking this so we don't get an error.
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.
👍
const wrapper = shallow( | ||
<RepositoryProfile {...defaultProps} loading={true} /> | ||
); | ||
const theIcon = wrapper.find({ name: 'fiber-manual-record' }); |
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.
It's a bit weird to use "the" in a variable name (unless you have a specific reason?) How about just const icon = wrapper.find({ name: 'fiber-manual-record' });
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.
Yeah that works too. Will update it on my next PR
Related to #518