Skip to content
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

Merged
merged 4 commits into from Oct 30, 2022
Merged

feat: add jest mock #492

merged 4 commits into from Oct 30, 2022

Conversation

vonovak
Copy link
Member

@vonovak vonovak commented Aug 22, 2018

No description provided.

Copy link
Collaborator

@jozan jozan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! :)

@jozan
Copy link
Collaborator

jozan commented Sep 9, 2018

Is there something missing which prevents merge to master?

@vonovak
Copy link
Member Author

vonovak commented Sep 9, 2018

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.

@neiker
Copy link

neiker commented Oct 16, 2019

For future readers, isSignedIn is missing:

isSignedIn: jest.fn(() => Promise.resolve(true)),

@pawndev
Copy link

pawndev commented Aug 16, 2020

Hey guys !
Just wondering if there is any plan to continue this PR ?

@OzzieOrca
Copy link

#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.mock('react-native-google-signin', () => ({

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
jest.mock('react-native-google-signin', () => ({
jest.mock('@react-native-community/google-signin', () => ({

Comment on lines 22 to 23
signInSilently: jest.fn(() => Promise.resolve(mockUserInfo)),
revokeAccess: jest.fn(() => Promise.resolve(true)),
Copy link

@OzzieOrca OzzieOrca Sep 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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)

@hungvu193
Copy link

May I know why is it still open?

@jnawaz
Copy link

jnawaz commented Oct 24, 2022

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.

@vonovak
Copy link
Member Author

vonovak commented Oct 25, 2022

hmm, yeah, after 4 years I might finally push it over the line.. 😆
give me a week or so pls

@vonovak vonovak changed the title [wip] add jest mock feat: add jest mock Oct 30, 2022
@vonovak vonovak merged commit 51c0c2b into master Oct 30, 2022
@vonovak vonovak deleted the @vonovak/jestMock branch October 30, 2022 12:52
github-actions bot pushed a commit that referenced this pull request Oct 30, 2022
# [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.
@github-actions
Copy link

🎉 This PR is included in version 8.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@jnawaz
Copy link

jnawaz commented Nov 3, 2022

@vonovak Legend!! I suspect this will be huge for folks wanting to test Google Sign In 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants