Unit Testing in Nest.js with Jest #1 - All About Mock, Testing Service Files
Вставка
- Опубліковано 20 чер 2023
- Final Code:
github.com/ghulamabbas2/libra...
Complete In-Depth NestJs UDEMY Courses:
www.udemy.com/course/nestjs-b...
⚙️ Gadgets I use for Recording:
💻 Laptop - Macbook PRO M1 - 16/512
amzn.to/4eUqrSe
🎤 MIC - Samson Technologies Q2U USB/XLR Dynamic Microphone
amzn.to/3W9Z4wl
🖱️Mouse - Logitech G402 Gaming Mouse Hyperion Fury USB, Black
amzn.to/3RY4xUy
⌨️ Keyboard - Logitech K380 Multi-Device Bluetooth Keyboard
amzn.to/3RY4Fn0
🖥️ Monitor - UltraSharp 24-Inch Screen Led-Lit Monitor (U2419H)
amzn.to/4bxidN6
In this video, we delve into the exciting world of unit testing in Nest.js using Jest. In this first video of our series, we focus on all things mock and testing service files. We explore different approaches to mocking in Nest.js, highlighting best practices.
Make sure to subscribe to our channel and hit the notification bell, so you don't miss the upcoming videos in this series. We love hearing from our viewers, so please leave your comments and questions below. Let's dive into the world of unit testing in Nest.js with Jest together!
Thank you Abbas, i'm learning to much with this playlist.
I usually work with "pure" nodejs + express, but i'm starting to migrates our services here in the company to nest js.
Greattings from Brazil.
+1 Subscriber !!
Very good!! Thank you!!
nice job 👍
thank you, nice video
Wow nest js good
how to integrate , when the service need to be tested has constructor and how to handle it in the unit testing?
I am having problems with nestjs, for example, I am using sequelize, I have repository, which uses model injection, repository is being injected into services. I am trying to test it, but it's giving me require stack errors. I don't but it expects, I have tried passing relative paths in the code and simple path as well. Any ideas?
First mistake is using sequelize, it's unnecessary complex. Just use Prisma
can you add the start project?
Do you mean by project videos? If yes, then you can watch here:
ua-cam.com/play/PLdAEGQHOerPAMLdJim5Peryj6_2Q-477Z.html
i got this issues following properties from type '(Document & Users & { _id: ObjectId; })[]': length, pop, push, concat, and 29 more.
73 .mockImplementationOnce(() => Promise.resolve(mockUsers)); can anyone help me out please
Promise.resolve(mockUsers as any)
won't you be doing something in react here.
This is not about react, Nest.js in backend Node.js framework used to build APIs.
@@codingwithabbas do a react project pls.. with hooks and redux.
jest.spyOn(model, when i try to use the method name i cant find it. There is only collection) help me !