JavaScript: More testing section is hard to understand #26431
CoolNewsGuy
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Describe your suggestion
Maybe it's just me but I'm having a hard time understanding jest mocks. I've read every resource carefully but I'm still unable to understand them. Like how do I actually put them in practice? I'm trying to use them for Battleship project which is the last one in JavaScript course but I just couldn't understand. For example (the code is from jest: Mock Functions):
when I run the test both in js and ts, I get error axios.get.mockResolvedValue is not a function (I installed the package btw).
Like what is jest.mock() actually doing? I don't get it and how to prevent this error? I tried googling but no luck.
Also how to mock for example, fetch api or console.log for testing? It's not clear how to mock such stuff with side effects.
This section should probably contain some resources to practice these skills or at least simplify mocking.
Path
Node / JS
Lesson Url
https://www.theodinproject.com/lessons/node-path-javascript-more-testing
Checks
Beta Was this translation helpful? Give feedback.
All reactions