NestJs Testing Tutorial - Integration Testing

NestJs Testing Tutorial - Integration Testing

Code with Vlad

2 года назад

21,982 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@Alex-bc3xe
@Alex-bc3xe - 20.04.2023 15:55

I am a big fan of Docker and Nest JS and of course Angular for the frontend and you are really good at Nest JS thx a lot.

Ответить
@vladyslavgooglya9902
@vladyslavgooglya9902 - 07.04.2023 20:12

Hey, excellent guide. However, I'm getting the error "TypeError: this[modelKey].deleteMany is not a function", the line "await prisma.cleanDatabase()". Do you know, how can I fix it?

Ответить
@deveshsrivastava2718
@deveshsrivastava2718 - 21.12.2022 17:18

Hi Vlad, It's a very nice feeling to write and thank you for all your videos, especially NestJS one's. They are very informatic and crystal clear. I am a backend developer working with express JS and Now when I received an opportunity from my organization to work on NestJS, your tutorials are really a life saver.
I would humbly request you to kindly prepare a tutorial on writing unit tests with Jest for NestJS and prisma application. Looking forward for this tutorial. Thanks

Ответить
@rainbow-jw3og
@rainbow-jw3og - 06.10.2022 14:57

I have this problem
"Cannot find module 'src/modules/auth/auth.module' from 'app.e2e-spec.ts'"
I copy your jest-int but i have problem :(

Ответить
@DelaAnthonio
@DelaAnthonio - 03.08.2022 02:57

What font do you use in your editor?

Ответить
@kevinterrier5893
@kevinterrier5893 - 26.07.2022 12:30

Hello
Thanks for all the things you shared !

Can you please do a video on How to deploy NestJs app ?
Thanks a lot !

Ответить
@user-pk7ew6dq9h
@user-pk7ew6dq9h - 13.07.2022 15:06

Как всегда ТОП!)

Ответить
@adamtak3128
@adamtak3128 - 30.05.2022 03:49

Hey Vlad, when using Prisma with Nest, should I be using the Prisma generated types or create my own DTO class with class-validator? The benefit with class-validator is that I can make sure a field is not empty or has a min/max length etc so in that case I prefer it but idk ... When it comes to filtering options or unique input fields, etc the Prisma generated types are really handy.

Ответить
@Fran-zq2fx
@Fran-zq2fx - 03.05.2022 15:57

thank you so much for this excellent tutorial. Just one question: I have tried to "inspire" to this project and re-recreate it in order to train my self and my mini-app where I use MySQL as db. I am experiencing issues when using the concatenated scripts to stop the containers, start them, run the migrations on the test db and run the tests. Apparently, it looks like the migration is run before the containers are completely ready, even if I tried to increase the sleep time. In you experience, does mySQL produces this kind of issues? And how can I fix it? So far I solve with the hack of starting the db and THEN run the script for the migration & test

Ответить
@rained23JMTi
@rained23JMTi - 27.04.2022 23:05

so integration test is basically doing testing of your code integration with other module/ 3rd party ?
the principle is to not trust the 3rd party that you integrating ?

I just don't get what the point of it because for sure prisma already run their own test suite to make sure their released code works
another thing is should you do integration test and e2e too or e2e can considered enough ?

Ответить
@DevilDude
@DevilDude - 09.04.2022 22:20

Hey Vlad, I came from the FreeCodeCamp tutorial for NestJS. Great job BTW with that course. It was the least painful way to learn.

Hoping to learn more about other kinds of test as you mentioned some things being outside the scope of "that" video.

I was trying to continue with the bookmark app project here but I am a bit confused about the nature of integration testing.

If I have a service for creating a user in the user module.
0. Should I use that to create the user in the integration testing for the related data(todo, bookmark, etc...), or is it required to create a new user using the ORM (Prisma) directly?

I would really love to hear some of your thoughts about the approaches to take with integration testing on backend.

I am trying to figure out how Integration testing is different than other forms of testing (e2e in this case).

Really look forward to learning and getting into TDD so we can make certain CI/CD pipelines more robust in our organization. (It's held together by duct tape and a can debug attitude for now.)

So far the e2e testing is a no brainer as it help achieve large coverage of our entire API logic with which the front-end is going to interact with. (Majorly Rest Request)

Questions:

1. Should integration testing even be required for the NestJS application if we improve our code coverage in the e2e tests?

2. Should integration testing be done with the frontend (assuming we have to spin up a test server for this)?

3. If the end goal is to maintain all the functionality intact with newer features and account for more edge case, should an approach where the e2e test coverage is increased on both front-end and backend and can the dedicated "Integration" testing be prioritized lower?

Would love to hear more from you.

Cheers.

Ответить
@debarghyachakraborty
@debarghyachakraborty - 07.04.2022 20:09

If anyone encounters the error of property 'user' does not exist on prisma, just update the @prisma/client package to latest version.

Ответить
@binov5012
@binov5012 - 27.02.2022 22:17

Thanks a lot Vlad! Can you make a tutorial for GraphQL with Nest.js?

Ответить
@AT-mx3bx
@AT-mx3bx - 14.12.2021 20:53

Very useful video!! Thanks a lot for sharing

Ответить
@victordepta4069
@victordepta4069 - 07.12.2021 21:32

Well done. It's a classical way of testing I think, but ofc still kudos.

Ответить