這兩個名詞時常混淆,摘錄在 Stake overflow 看到的簡潔說明 (Ref.)。
A stub is a simple fake object. It just makes sure test runs smoothly.A mock is a smarter stub. You verify your test passes through it.
這篇文章記錄如何在 Angular unit test 時對子(child) Component 進行模擬(mock)。