Complete the code to import the Supertest library.
import request from '[1]';
The supertest library is imported as request to perform HTTP requests in E2E tests.
Complete the code to create a NestJS testing module for E2E tests.
const moduleRef = await Test.createTestingModule({ imports: [[1]] }).compile();In NestJS E2E tests, you import the main AppModule to test the full application.
Fix the error in the test to correctly send a GET request to '/users'.
return request(app.getHttpServer()).[1]('/users').expect(200);
To test a GET request, use the get method of Supertest.
Fill both blanks to check the response body contains a user with id 1.
expect(response.body).toEqual(expect.arrayContaining([expect.objectContaining({ id: [1], name: [2] })]));The test checks if the response body array contains an object with id 1 and name 'John'.
Fill all three blanks to send a POST request with JSON body and check status 201.
return request(app.getHttpServer()).[1]('/users').send({ name: [2] }).expect([3]);
Use post to send data, 'Alice' as the name in JSON, and expect HTTP status 201 for resource creation.
