Answer the question
In order to leave comments, you need to log in
How did you learn Jest?
Good evening, I decided to learn Jest for unit tests, I started with the documentation. But I can’t understand about MOKIs, how to use them, how functions are imitated with the help of them, I have such a mess. Can you tell me a good good source for Jest
Answer the question
In order to leave comments, you need to log in
Look, relax, it's not that hard, take your time.
Mokk is just an imitation of a function that you can spy on (see if it was called, with what parameters, etc.)
Stubb is just a stub.
How to create mocks - is in the documentation.
But for example:
1. There is a heavy method that pulls something from the database and so on.
2. You need to test the code that uses this method.
And in order not to pull the base, not to wait, etc., etc., you can simply create an imitation of this method and observe it, whether it was called, with what parameters, etc.
This applies to any testing, Jest, mocha, etc., the framework is not important here.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question