Recall & Review
beginner
What is the main purpose of E2E testing in a NestJS application?
E2E testing checks the whole application flow from start to finish, ensuring all parts work together as expected, like a user interacting with the app.
Click to reveal answer
beginner
What role does Supertest play in E2E testing with NestJS?
Supertest helps simulate HTTP requests to the NestJS app, allowing tests to check responses without needing a real browser or client.
Click to reveal answer
intermediate
How do you start a NestJS application instance for E2E testing with Supertest?
You create a testing module with Test.createTestingModule, compile it, then create a Nest application instance and call app.init() before running tests.
Click to reveal answer
intermediate
Why is it important to close the NestJS app after E2E tests finish?
Closing the app frees resources and stops the server, preventing conflicts or memory leaks when running multiple tests.
Click to reveal answer
intermediate
What is a common pattern to test an HTTP POST request using Supertest in NestJS E2E tests?
Use supertest's request(app.getHttpServer()).post('/route').send(data).expect(statusCode) to send data and check the response status and body.
Click to reveal answer
Which method initializes the NestJS app instance for E2E testing?
✗ Incorrect
app.init() prepares the NestJS app instance for handling requests in tests.
What does Supertest simulate in E2E tests?
✗ Incorrect
Supertest simulates HTTP requests to test server responses.
In NestJS E2E tests, where do you get the HTTP server instance for Supertest?
✗ Incorrect
app.getHttpServer() returns the underlying HTTP server for Supertest to send requests.
Why should you call app.close() after E2E tests?
✗ Incorrect
app.close() stops the server and frees resources after tests.
Which NestJS testing utility helps create a testing module for E2E tests?
✗ Incorrect
Test.createTestingModule() builds a module for testing purposes.
Explain the steps to set up and run an E2E test in NestJS using Supertest.
Think about setup, request simulation, assertions, and cleanup.
You got /6 concepts.
Describe why E2E testing with Supertest is useful for a NestJS application.
Focus on the benefits of testing the whole app behavior.
You got /4 concepts.