Unit Testing In Nestjs - The Complete Guide

Posted By: ELK1nG

Unit Testing In Nestjs - The Complete Guide
Published 10/2022
MP4 | Video: h264, 1280x720 | Audio: AAC, 44.1 KHz
Language: English | Size: 1.71 GB | Duration: 2h 54m

Learn Unit Testing with NestJs, Jest, GraphQL, Prisma, and Postgres

What you'll learn
Build CRUD REST APIs with Nestjs, Postgres
Learn Unit Testing with Jest, Nestjs, and Postgres
Mocking in Jest Framework
Test the GraphQL and Prisma based API
Learn how to write unit test for CRUD GraphQL based APIs
Requirements
Knowledge of Nestjs is required
Knowledge of Nodejs is requried
Description
Test-driven development is a powerful tool for preventing bugs within your application. NestJs Unit testing is the method of testing small pieces of code/components in isolation in your NestJS application. This helps in improving the code quality and helps in finding bugs early on in the development life cycle. This also provides an added advantage to the users in the way that they can add any new features without breaking any other part of their application.Why Unit Testing?* It helps you to write better code
* It enables you to catch bugs earlier
* It makes your code easy to refactor
* It makes you more efficient at writing code
We are going to use the Jest framework in this course. Jest is an open-source Javascript testing framework developed by Facebook. It was mainly built for React, Node, Babel, TypeScript, Angular, Vue, and JavaScript-based applications. It primarily focuses on simplicity and support for large web applications. Jest was built on top of Jasmine with multiple layers.In this course, We are going to build two different applications. In the first application, we are going to build the CRUD(create, read, update, delete) endpoints using Nestjs, and Postgres without TypeORM
In the next part, we are going to test GraphQL and Prisma API. I will teach you how to write unit tests using the Jest framework. You will also learn mocking in Jest and much more.

Overview

Section 1: Getting started with NestJs and setup Database

Lecture 1 Getting Setup

Lecture 2 Setting Database Configurations

Lecture 3 Creating Database Service

Lecture 4 Creating Service and Repository

Lecture 5 Get Records from DB

Section 2: Create, Read, Update, and Delete Operations

Lecture 6 Find one record by ID

Lecture 7 Create new record in DB

Lecture 8 Delete Record

Lecture 9 Update Record

Section 3: Testing CRUD features

Lecture 10 Creating Mock Functions

Lecture 11 Testing CRUD features part 1

Lecture 12 Testing CRUD features part 2

Section 4: Getting started Testing with Prisma, GraphQL and NestJs

Lecture 13 Creating Mock Functions

Lecture 14 Write Logic before running tests

Lecture 15 Test the update feature

Section 5: Testing CRUD Features with Prisma

Lecture 16 Test the delete Feature

Lecture 17 Test the Find user Feature

Lecture 18 Test the Create user Feature

Lecture 19 Run the Test for create user

NestJs developers who want to learn how to do unit testing,NodeJs developers who want to learn how to do testing in Typescript and Jest,NodeJs developers who want to learn the Jest Framework