Q79: What is the difference between mocks and stubs in Node.js unit testing?
Stubs provide canned responses to method calls made during tests without recording call assertions. Mocks are pre-programmed with expectations regarding calls they should receive.
Key Takeaways
Stubs return static predefined data during test execution.
Mocks verify specific behavioral interaction expectations.
Knowledge Check
Which test double type asserts whether a specific method was invoked with particular arguments?