
End-to-End Testing
Supertest, test database, fixtures, authentication in tests, API testing
1What is an E2E (end-to-end) test in the context of NestJS?
What is an E2E (end-to-end) test in the context of NestJS?
คำตอบ
An E2E test validates the complete application flow, from HTTP request to response, through all layers (controller, service, database). Unlike unit tests that isolate a component, E2E tests verify that the integration of all components works correctly. This helps detect integration bugs that unit tests cannot capture.
2What is the recommended library by NestJS for E2E testing?
What is the recommended library by NestJS for E2E testing?
คำตอบ
Supertest is the recommended library for E2E testing in NestJS because it allows testing HTTP endpoints without starting the server on a network port. It creates an isolated application instance and sends simulated HTTP requests directly. This makes tests faster, more reliable, and avoids port conflicts between parallel tests.
3How to get the HTTP server instance for Supertest in a NestJS test?
How to get the HTTP server instance for Supertest in a NestJS test?
คำตอบ
The app.getHttpServer() method returns the underlying HTTP server instance (Express or Fastify) that can be passed to Supertest to make test requests. This method is available after creating the test module with Test.createTestingModule(). It allows Supertest to directly access the server without having to start it on a network port.
In which file are E2E tests typically placed in a NestJS project?
Which Supertest method allows checking the status code of an HTTP response?
+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
Unit Testing
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
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 และตัวจำลองสัมภาษณ์
เริ่มใช้ฟรี