
Unit Testing
Jest, test suites, mocking, spies, test coverage, testing providers, controllers
1What is the role of the describe() function in Jest?
What is the role of the describe() function in Jest?
คำตอบ
The describe() function groups multiple related tests together in a test suite. It improves readability by organizing tests by feature or component. Each describe() can contain multiple it() or test() to describe individual behaviors.
2What is the difference between it() and test() in Jest?
What is the difference between it() and test() in Jest?
คำตอบ
There is no functional difference between it() and test() in Jest. They are two aliases that do exactly the same thing. The choice between them is purely a matter of style and writing preference. Some prefer it() for a more natural BDD syntax, others prefer test() for clarity.
3Which Jest matcher should be used to verify that a value is strictly equal to another?
Which Jest matcher should be used to verify that a value is strictly equal to another?
คำตอบ
The toBe() matcher checks strict equality using the === operator in JavaScript. It compares references for objects, meaning two objects with the same content but different references won't be equal. To compare object content, use toEqual() instead.
What is the difference between toEqual() and toStrictEqual()?
How to execute code before each test in a Jest suite?
+17 คำถามสัมภาษณ์
หัวข้อสัมภาษณ์ Node.js / NestJS อื่นๆ
Node.js Fundamentals
Node.js Core APIs
Asynchronous Programming
Express.js Basics
NestJS Fundamentals
REST API Design
Validation & DTO
API Documentation & Contracts
Error Handling
Task Scheduling
NestJS Modules & DI
Configuration & Environment Management
JWT Authentication
Authorization & RBAC
Database with TypeORM
Prisma ORM
Middleware & Interceptors
File Upload
WebSockets
GraphQL with NestJS
End-to-End Testing
Caching with Redis
Queues with Bull
DevOps, Logging & CI/CD
Docker & Containerization
Microservices
Security Best Practices
Performance & Cloud Deployment
เชี่ยวชาญ Node.js / NestJS สำหรับการสัมภาษณ์ครั้งถัดไป
เข้าถึงคำถามทั้งหมด flashcards แบบทดสอบเทคนิค แบบฝึกหัด code review และตัวจำลองสัมภาษณ์
เริ่มใช้ฟรี