All quizzes
Free quiz · 20 questions in the bank

Chai HTTP quiz

Test your Chai HTTP knowledge with a free interactive quiz — 20 questions with answers and explanations. No signup needed to play.

Question 1/5Score 0

What is the purpose of `expect(res).to.be.json` as a Chai HTTP-specific assertion?

Questions in this quiz
  1. What is the purpose of `expect(res).to.be.json` as a Chai HTTP-specific assertion?
  2. Why might a team choose to write Chai HTTP-based integration tests specifically for critical API endpoints, in addition to unit tests for the underlying business logic those endpoints depend on?
  3. How do you send a JSON request body with a POST request using Chai HTTP?
  4. How does Chai HTTP relate to Chai's core `expect`/`should`/`assert` interfaces, given that it's described as a "plugin"?
  5. What does `res.body` typically contain after a Chai HTTP request completes, assuming the server responded with JSON?
  6. What is the basic pattern for making a test request with Chai HTTP against an Express app?
  7. How does Chai HTTP typically handle testing an endpoint expected to return an error status, like a 404 or 400?
  8. What is Chai HTTP?
  9. What is the purpose of testing an Express application via actual HTTP requests (as Chai HTTP enables) rather than only unit-testing individual route handler functions by calling them directly with mocked request/response objects?
  10. What is a reasonable use case for `.field()` and `.attach()` methods in Chai HTTP (mirroring similar functionality in the underlying superagent library it builds on)?
  11. How does Chai HTTP typically handle testing an endpoint that requires an `Authorization` header (e.g. a bearer token)?
  12. What is a reasonable comparison between Chai HTTP and SuperTest, given that both are popular Node.js libraries for testing HTTP servers?
Gaps to close?
Read the curated Chai HTTP notes — core concepts, patterns, interview prep.
Chai HTTP notes

More quizzes

.NET.NET MAUIAbsintheAccessibilityActixActix Web