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
feat: add jest mock #492
feat: add jest mock #492
Conversation
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.
Great! :)
Is there something missing which prevents merge to master? |
yeah, I wanna make this a little more flexible by allowing to choose mocking success / cancel / other cases. Just need to find some extra time for this. |
For future readers, isSignedIn: jest.fn(() => Promise.resolve(true)), |
Hey guys ! |
#164 (comment) appears to be another attempt at a mock for this package. I'd say merging a default mock would be helpful. Consumers can use the Jest API to make it return other values. Not really sure how else you'd make a customizable mock and haven't seen it done in other packages but I'd be curious about how to make one. |
jest/RNGoogleSigninMock.js
Outdated
}, | ||
}; | ||
|
||
jest.mock('react-native-google-signin', () => ({ |
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.
jest.mock('react-native-google-signin', () => ({ | |
jest.mock('@react-native-community/google-signin', () => ({ |
jest/RNGoogleSigninMock.js
Outdated
signInSilently: jest.fn(() => Promise.resolve(mockUserInfo)), | ||
revokeAccess: jest.fn(() => Promise.resolve(true)), |
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.
signInSilently: jest.fn(() => Promise.resolve(mockUserInfo)), | |
revokeAccess: jest.fn(() => Promise.resolve(true)), | |
signInSilently: jest.fn(() => Promise.resolve(mockUserInfo)), | |
isSignedIn: jest.fn(() => Promise.resolve(true)), | |
revokeAccess: jest.fn(() => Promise.resolve(true)), |
Credit to #492 (comment)
May I know why is it still open? |
Hey @vonovak 👋, would be nice to see this PR get over the line, what do you have left to do. I wouldn't mind getting involved and help contribute. |
hmm, yeah, after 4 years I might finally push it over the line.. 😆 |
8a8d540
to
005c760
Compare
c362065
to
0759042
Compare
# [8.1.0](v8.0.1...v8.1.0) (2022-10-30) ### Features * add jest mock ([#492](#492)) ([51c0c2b](51c0c2b)) If this package helps you, please [consider donating](https://github.com/sponsors/vonovak) to support the development of this package.
🎉 This PR is included in version 8.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
@vonovak Legend!! I suspect this will be huge for folks wanting to test Google Sign In 🚀 |
No description provided.