All quizzes
Free quiz · 20 questions in the bank

Sinon quiz

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

Question 1/5Score 0

What is `sinon.createStubInstance(SomeClass)` used for?

Questions in this quiz
  1. What is `sinon.createStubInstance(SomeClass)` used for?
  2. What is the key difference between a Sinon spy and a Sinon stub?
  3. What does `sinon.assert.calledOnce(spy)` provide compared to manually checking `spy.callCount === 1`?
  4. Why does testing code that depends on `Date.now()` or `new Date()` often benefit from Sinon's fake timers rather than just calling the real Date API?
  5. What is a Sinon "spy"?
  6. Can a Sinon stub be configured to behave differently on successive calls, e.g. failing the first time and succeeding after?
  7. What is a Sinon "stub"?
  8. What is Sinon.js?
  9. What is a Sinon "mock," and how does it differ from a stub?
  10. What is a potential downside of over-using stubs/mocks in a test suite?
  11. Why is it important to call `.restore()` on a Sinon stub/spy after a test that replaced a method on a shared object?
  12. What does `sinon.fake()` (the newer, simpler fake-creation API) offer compared to the classic spy/stub/mock APIs?
Gaps to close?
Read the curated Sinon notes — core concepts, patterns, interview prep.
Sinon notes

More quizzes

.NET.NET MAUIAbsintheAccessibilityActixActix Web