This is gold! As my teacher used to say, ‘pay attention because you won’t find this talk in a pub!’ :)
@thong.nguyen172 жыл бұрын
This is absolutely hidden gem!
@DevMastery5 жыл бұрын
If you like this video, you'll love my newsletter. www.devmastery.com What else would you like to see on this channel? Leave a comment below.
@enzoferey5 жыл бұрын
Thank you, very instructive as per usual ! Keep up the nice content :)
@JamieNeubertPedersen5 жыл бұрын
Thank you for the video. If you had multiple functions calling the API (e.g. findMovies, findPosters, findRatings) would you then move the axios dependency out into a different function so you don't have to use it explicitly in every function?
@DevMastery5 жыл бұрын
No. But I understand where you're coming from. At the heart of your question is the desire to isolate things that are likely to change from things that are expensive to change. But because axios is extremely popular, widely used, well supported, and based largely on the HTTP spec, it's less likely to change in ways that break my app. Furthermore, because I have isolated my query and normalization logic such that they have no dependancy on axios, the cost of mitigating a breaking change is fairly low. I can easily create an adaptor and search/replace "import axios from 'axios'" to "import axios from './my-axios-adaptor' and I have a test suite at my back that will tell me if my new adaptor broke anything. So, writing and using such an adaptor ahead of time, is probably not worth the effort in this particular case.
@Tejas-zx7ie4 жыл бұрын
5:50 I don't understand why you don't recommend using mock. Though we set the mock responses, we are still testing the functionality that we wrote. Mock just intercept and instead of sending req to actual API, it uses its own function that we define. I don't understand how using mock is any different than doing what you did. Ultimately, we are using dummy data to test + using mock from Jest has some advantage of having more additional tests on the test itself with ".toHavBeen.." functions. Could you please explain if I am missing something?
@jacsurfing5 жыл бұрын
i have to wait until Monday to see your update. come on, man. update twice a week or more. i just can't wait