Skip to content

Reference about the mocks folder #181

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

Merged
merged 1 commit into from
Sep 18, 2018
Merged

Reference about the mocks folder #181

merged 1 commit into from
Sep 18, 2018

Conversation

vctormb
Copy link
Contributor

@vctormb vctormb commented Sep 18, 2018

What:
Well, I was struggling to mock the axios response following the main example here. After hours searching it, I've discovered that we can add the mocks folder to mock functions.

Why:
I've added a small line of comment to reference about the manual-mocks to be more clear and facilitate to the beginners.

How:
I followed the example inside the jest documentation.

Checklist:

  • Documentation
  • Tests
  • Ready to be merged
  • Added myself to contributors table

Kent, I'm new into the testing world and I didn't understand very well why in the doc example was created a mocks folder just to mock the .get function. Why not only use the jest.mock('axios') instead? Thank you!

I've added a reference about the manual mocks when importing 'axiosMock'.
Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

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

Super 👍

@kentcdodds kentcdodds merged commit dd433c0 into testing-library:master Sep 18, 2018
@kentcdodds
Copy link
Member

🎉 This PR is included in version 5.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

2 participants