All quizzes
Free quiz · 20 questions in the bank

SuperTest quiz

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
  1. How does SuperTest typically handle testing an endpoint that is expected to return a non-2xx error status, like a 404 or 400?
  2. What is SuperTest?
  3. How does SuperTest relate to a test runner like Jest or Mocha?
  4. 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?
  5. 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?
  6. 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?
  7. How do you send a JSON request body with a POST request using SuperTest?
  8. How would you test an endpoint that requires an `Authorization` header (e.g. a bearer token) using SuperTest?
  9. 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?
  10. How does SuperTest handle testing endpoints that require query string parameters (e.g. `GET /search?q=test&page=2`)?
  11. What does `.expect(200)` do in a SuperTest chain?
  12. How would you typically structure a SuperTest suite to reset database state between tests that create/modify data via API calls?
Gaps to close?
Read the curated SuperTest notes — core concepts, patterns, interview prep.
SuperTest notes

More quizzes

.NET.NET MAUIAbsintheAccessibilityActixActix Web