---
# System prepended metadata

title: 'Learning NestJS, Part4'
tags: [Nestjs]

---

# Learning NestJS, Part4
###### tags: `Nestjs`
[NestJS: The Complete Developer's Guide](https://www.udemy.com/course/nestjs-the-complete-developers-guide/) Section 11 on Udemy

## 驗證

### 驗證流程
![](https://hackmd.io/_uploads/S1cdHRtV3.png)

### User Module中的交互關係
![](https://hackmd.io/_uploads/rJYFB0tN3.png)

### 如何處理Session Data
![](https://hackmd.io/_uploads/HJs6T19Vh.png)

### 驗證系統功能
![](https://hackmd.io/_uploads/ryGk8bqN3.png)
![](https://hackmd.io/_uploads/H1lZlMqEh.png)

---

## 單元測試

### 登入登出測試

在測試時提供假的UserService給AuthService使用
![](https://hackmd.io/_uploads/HJhD1m5Vh.png)

當任何人需使用到UsersService
![](https://hackmd.io/_uploads/r1-unX5E3.png)

**於package.json內將scripts中的
"test:watch": "jest --watch"
改成
"test:watch": "jest --watch --maxWorkers=1"
可加快測試速度**
