Unit Testing for Typescript & NodeJs Developers with Jest

Unit Testing for Typescript & NodeJs Developers with Jest

English | MP4 | AVC 1280×720 | AAC 44KHz 2ch | 95 lectures (10h 56m) | 5.62 GB

Master unit testing with NodeJs, Typescript, Jest and React. Write top quality Typescript and NodeJs software with Jest

A must have skill for senior developers

Typescript is getting more and more popularity and it is a required skill for many IT jobs. It’s key feature is type safety, thus preventing bugs.

But yes another skill is very important for any programming job: unit testing. Combining these two techniques will result in solid, robust and bug free code.

This course will go beyond the basics of unit testing and teach you all you need to write real world, complex testing suites for NodeJs and Typescript applications using the most popular JavaScript testing library: Jest.

Using Jest as an unit testing library provides many advantages:

Unitary unit testing library for running and structuring tests

Extensive mocking, stubbing and spying capabilities

Powerful matchers to create simple to read tests

Jest ships as one unitary NPM package

Jest is the default choice for TypeScript React projects

Why unit testing NodeJs apps?

Unit testing usually adds a lot to a code base, two or tree times in some cases. This also means that a lot of time needs to be invested in writing and setting up tests. But all this effort pays of: time, effort and headache of fixing bugs can be used for more fun activities.

What you will get from this course:

setup NodeJs and Typescript projects from scratch

implement unit testing with Jest

learn about unit testing configuration with parameters like: roots, transform, testRegex or verbose

learn about Jest test suites structure: describe with value, test, descriptions, hooks like beforeEach

basic and advanced assertions, comparing primitive types, objects or even errors

instantiating test double objects like mocks, stubs, spies or fakes.

write complex mock objects which can be used with “strange” JavaScript libraries.

inject doubles: directly inside the constructor, over the module or even using the objects prototype

learn about deep mocks and matchers to make your tests even better

integration tests for a NodeJs server application

Conditionally and asynchronously skip tests

Dedicated sections on unit testing mocks:

Jest mocks, spies

How to use stubs

London/Chicago testing approach, with the advantages and disadvantages of each one

In this course you will learn how to use Test Driven Development (TDD):

Analyze the advantages of TDD

Hands-on practice with a great coding kata: password checker

Separate section on Jest Integration tests for Rest APIs:

learn how to setup integration tests

learn the difference between integration tests and unit tests

write integration tests for a Rest API with Jest

Dedicated section on Jest React unit testing:

How to test for React components with Jest

How to test React async code

How to debug React Typescript apps

The examples used in the course follow very high coding guidelines for Typescript, NodeJs and React. Async/await syntax is used for clear and concise code, and of course, you will see how to test asynchronous code, on server, but also in the front end.

Course advantages:

Respect for your time: most of the time of the instructor typing is cut off, the course is focused on unit tests and Jest explanations

Concise: learn only what you need, no fillers to make the course falsely more appealing

Experienced and programming active instructor: a great teacher never looses touch with the industry. This is especially true for software development, where the industry is so dynamic. This helps the instructor stay up to date with the best coding guidelines and present you the challenging parts, not the “hello world”

Organized course structure: six parts, progressive approach, consistent content

Code changes in each lecture on Git with code diffs: this will help you get an concise overview of the lecture and correct in case you missed something

Big font, dark background, fullHD content, this way it is readable even on a small screen or even tablet.

Lifetime access

Certificate of completion to present to your current or prospective employer

Do you want your Typescript or NodeJs code to have the best quality, and your project to be safe?

Table of Contents

Getting started
1 How to take this course
2 Tools we will need
3 Why we need tests

Basics of testing with Jest
4 Section intro
5 Jest introduction
6 Jest project setup
7 Structure of an unit test
8 Jest assertions and matchers
9 Multiple tests structure
10 Parametrized tests

Intermediate testing topics
11 Section intro
12 FIRST principles
13 Jest hooks
14 Testing for errors
15 Jest aliases and watch mode
16 VSCode debug configuration
17 Coverage

Test Driven Development with Jest and TypeScript
18 Section intro
19 Test Driven Development intro
20 Coding Katas password checker
21 PassChecker setup
22 PassChecker Iteration 1
23 PassChecker Iteration 2
24 PassChecker Iteration 3

Test doubles in Jest
25 Section intro
26 What are test doubles
27 Stubs
28 Fakes
29 Mocks
30 Spies
31 Mocking modules

Test doubles in practice
32 Section intro
33 Project presentation
34 Project installation
35 Testing arrays
36 Mocking consumer classes
37 Injecting mocks
38 Explaining tests
39 Event based app tests
40 Server tests 1 setup
41 Server tests 2 advanced debugging
42 Server tests 3 prototype spies
43 Finishing the tests
44 High mock tests conclusion

Low mocks tests
45 Section intro
46 Building testing wrappers
47 Setup tests
48 Finishing tests
49 Low mock tests conclusion

Integration testing
50 Section intro
51 Understanding integration tests
52 Integration tests setup
53 Writing integration tests

Other testing topics
54 Section intro
55 Environment variables
56 Multiple test configurations
57 Snapshot testing
58 Custom matchers
59 CICD pipeline using Github Actions
60 Exploring the NodeJs test runner module
61 Testing frameworks comparison

React unit testing with Jest
62 Section intro
63 Simple React Typescript app setup
64 Generics state props
65 What we will test
66 First tests rendering React TypeScript components
67 React testing library query for elements
68 Testing user interaction
69 Testing async updates

TypeScript recap
70 TypeScript presentation
71 Running TS code
72 Types in Typescript
73 User defined types
74 Optional properties
75 Type guards
76 Compiler options
77 Classes
78 Access modifiers
79 Inheritance
80 Interfaces
81 Generics
82 Promises
83 Modules
84 Strict mode
85 Undefined null never unknown
86 Enums and Swith statements
87 Runnnig on NodeJs
88 Debugging node TypeScript
89 Run in browser
90 TypeScript with Webpack
91 Decorators introduction
92 Method decorators
93 Outro

Course conclussions
94 Choosing a work project
95 Ending lecture

Homepage