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!

КОМЕНТАРІ • 16

  • @Paferreira100
    @Paferreira100 11 місяців тому +4

    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 !!

  • @cleziomarcos8395
    @cleziomarcos8395 8 місяців тому

    Very good!! Thank you!!

  • @hossein-kbh
    @hossein-kbh 5 місяців тому

    nice job 👍

  • @acanaldelbuencontenido
    @acanaldelbuencontenido 7 місяців тому

    thank you, nice video

  • @weforyouweb1165
    @weforyouweb1165 Рік тому

    Wow nest js good

  • @haristars6683
    @haristars6683 Місяць тому

    how to integrate , when the service need to be tested has constructor and how to handle it in the unit testing?

  • @gauravkumar6124
    @gauravkumar6124 Рік тому

    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?

    • @nanonkay5669
      @nanonkay5669 3 місяці тому

      First mistake is using sequelize, it's unnecessary complex. Just use Prisma

  • @y.d.y1293
    @y.d.y1293 Рік тому +1

    can you add the start project?

    • @codingwithabbas
      @codingwithabbas  Рік тому

      Do you mean by project videos? If yes, then you can watch here:
      ua-cam.com/play/PLdAEGQHOerPAMLdJim5Peryj6_2Q-477Z.html

  • @gisssk9236
    @gisssk9236 6 місяців тому

    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

    • @lautaro2484
      @lautaro2484 4 місяці тому

      Promise.resolve(mockUsers as any)

  • @sidds09
    @sidds09 Рік тому

    won't you be doing something in react here.

    • @codingwithabbas
      @codingwithabbas  Рік тому

      This is not about react, Nest.js in backend Node.js framework used to build APIs.

    • @sidds09
      @sidds09 Рік тому

      @@codingwithabbas do a react project pls.. with hooks and redux.

  • @actuallyzefe
    @actuallyzefe Рік тому

    jest.spyOn(model, when i try to use the method name i cant find it. There is only collection) help me !