Test your SuperTest knowledge with a free interactive quiz — 20 questions with answers and explanations. No signup needed to play.
Question 1/12Score 0
How does SuperTest typically handle testing an endpoint that is expected to return a non-2xx error status, like a 404 or 400?
In this round
How does SuperTest typically handle testing an endpoint that is expected to return a non-2xx error status, like a 404 or 400?
What is SuperTest?
How does SuperTest relate to a test runner like Jest or Mocha?
Why is testing against an in-memory app instance (passed directly to `request()`) generally preferred over testing against a separately-running live server on a fixed port?
What is the purpose of using `async`/`await` with SuperTest requests (e.g. `await request(app).get('/users')`) rather than relying purely on a `.then()`/callback style?
Why might a team choose to write integration tests with SuperTest against real HTTP request/response cycles, rather than only unit-testing individual route handler functions in isolation?
How do you send a JSON request body with a POST request using SuperTest?
How would you test an endpoint that requires an `Authorization` header (e.g. a bearer token) using SuperTest?
What is a potential pitfall of writing SuperTest assertions that check for an EXACT full JSON body match (e.g. `.expect(200, { id: 1, name: 'Alice', createdAt: '2024-01-01T00:00:00Z' })`) on an endpoint returning dynamically-generated data?
How does SuperTest handle testing endpoints that require query string parameters (e.g. `GET /search?q=test&page=2`)?
What does `.expect(200)` do in a SuperTest chain?
How would you typically structure a SuperTest suite to reset database state between tests that create/modify data via API calls?