Комментарии:
Thank you. Any video for complex json object test cases scripts example in jest?
ОтветитьGood content, but it's honestly really hard to watch, with everything jumping around on the screen. So please consider this, because it's really not easy on the eyes to consume your content, and it's hard to stay focused.
I haven't noticed that in your other videos though as much, but this one is kinda tough
I still hit that like button though, because there's still value in the video
Good video! I watched it for the second time.
ОтветитьCool ❤❤❤❤❤❤
ОтветитьHi, great video. I have a question tho, how do I mock a class service?
ОтветитьHello, thanks a lot for this tuto!
I have a problem with using the send method for a post/put request, I always get an error "Right-hand side of 'instanceof' is not callable"
What is the reason of this error?
I was absolutely clueless on how to mock my own functions. thank you so much
ОтветитьEven if I mock the service for user it still calls mongodb and creates it in database. Any thoughts?
ОтветитьThanks for the awesom video. You made my TDD weekend fun.
ОтветитьTHANK YOU SO MUCH for making this video. I've been looking for a compare and contrast of mongo-memory-server and mocking services for quite awhile!
ОтветитьWhich extension are you using to get "intellisense"-isc behaviour in the terminal?
And also which extension to get the "Run | Debug" options over each "Describe"-block?
can you please tell me which vs code extension you are using for highlighting the code block
Ответить.set('Authorization', `Bearer ${jwt}`) not working any idea why?
ОтветитьHi Tom! Your authentication API video with typegoose and zod helped me tremendously. I know i will learn a lot from this, so Thank you for making this video!
ОтветитьYou're awesome!
ОтветитьWhen testing api with ject, do you actually need to have data in database?
Ответитьreally helpful and fun, thank you.
ОтветитьI didn't enjoy this video as much as the last one the explanations were too brief it felt like you were just rushing true it also I did not really understand that last test so well. i don't have much experience in testing so maybe that is the problem. looking forward to the next video in the series. Thank you Tom.
ОтветитьI keep getting a 403 on this test
describe("given the user is logged in ", () => {
it("should return a 200 and create product", async () => {
const jwt = signJwt(userPayload);
const { statusCode, body } = await supertest(app)
.post("/api/products")
.set("Authorization", `Bearer ${jwt}`)
.send(productPayload);
expect(statusCode).toBe(200);
expect(body).toEqual({});
});
});
everything works 100% on postman
do you have a video with javascript and not typescript?
ОтветитьHi Tom, thanks for the video. With the updated repo, if you follow along to the video you will find that you will not be able to get most of the mongodb-memory-server section to work.
1. You will not be able to get product.productId after calling createProduct because productId doesn't exist in either the ProductDocument or ProductInput interface. To fix this I had to put productId: String in the ProductDocument interface, not sure if that is the right approach but the tests passed after that
2. You will not be able to use signJwt because it expects 2 parameters now, not sure how to get around this one. I skimmed through the rest of the video and didn't see any fixes for that so I stopped trying here.
Late comment but for some reason Jest times out when i'm running all of the test after I included the "should return a 200 and create the product"... but if I just run that test individually with '.only' then it doesnt time out and passes. I even tried extending the time but it still times out when running all of the tests.
Ответитьawesome tutorial🤌
Ответитьawesome video on testing with Jest
ОтветитьThanks you so much this video helped me a lot in braking the code and testing .
ОтветитьAmazing tutorials as always, love your Typescript/Mongoose/Express series
Ответитьwhich terminal you are using in VSCode?
ОтветитьAre these tests considered unit-tests or integration tests? I'm leaning towards unit-tests since there is not really a database interaction and you are only mocking a service. But what if in the service you make a call to the database and fetch some data, is it considered to be an integration test then?
Ответитьtldr version??
Ответитьgreat tutorial keep it up but why did you need ts-ignore on the mockReturnValue?
ОтветитьThis series is the best tutorial I've been following, thank you very much it is gold
ОтветитьThanks very much, great video. When testing 'user registration' for 'given username and password are valid', I kept getting a 'TypeError' => 'user.toJson is not a function' in the referencing user.controller.. I removed the toJson() from the omit function and test passed and the route still works without. Couldn't quite understand what the issue was? Testing removing toJson from the omit functions in user.service, the app broke on the spot.. tried JSON.stringify instead, he wasn't having it.. Anybody hat a similar problem? Tks, regards PS: just seeing now that in the controller the createUser() is called from where the user is returned through the omit function already... so in the controller I only return and send the user
ОтветитьHi! Great tutorial! Just wanted to ask what file icon theme are you using on vscode? thank you!
Ответитьwhy you dont use testing database? you are not testing much this way
Ответитьyou didnt explain clearly what is the difference between clearMocks and resetMocks? and what is the difference between supertest and plain axios?
Ответитьis it possible for someone to replace where we used mongodb-memory-server with the real MongoDB server?
ОтветитьGreat testing video. Appreciate your time and effort with it. Found your channel a few weeks ago and have slowly been making my way through all the videos. :)
ОтветитьThis is awesome!!! thank you for this lesson. One request, can we make it a full stack app i.e. can we build a frontend to consume this API? thank you once again.
ОтветитьHello) I am writing the fourth comment)
ОтветитьI keep getting "TypeError: (0 , supertest_1.default) is not a function." What's the problem here?
ОтветитьNice video.
I got a problem with this, inside config folder, test.ts file have the private key, if I remove the private key from test.ts file config and create the custom-environment-variables.ts file to read the variable from an env file, it doesn't work because can't read the private key value, if I just paste the private key into the test.ts file all work again, any idea or config I am missing there?
if anyone uses NPM run this command " npm run test -- --watch "
ОтветитьThis channel is a gem! I appreciate that you cover important and practical topics (i.e testing, TS) in great detail. I've seen some videos on the 2 topics mentioned above but not as as it pertains to Nodejs. Thank you and you definitely deserve more views/subscribers.
ОтветитьHi Tom, first of all thank you for your dedication for wanting to help others. I wanted to ask you how would I do the same with testing the endpoint only, without controllers and services?
ОтветитьPlease show us how to make the React front end to this API
Ответить