jestjs

Mocking methods on a Vue instance during TDD

混江龙づ霸主 提交于 2020-11-24 16:11:51
问题 I'm learning TDD whilst building my Vue app, and trying to abide by the strict laws of only writing enough production code to satisfy a failing unit test. I am really enjoying this approach, but I have run into a roadblock in regards to adding methods to a Vue instance, and testing that they have been called when the event fires from the element in the template. I cannot find any suggestions as to how I can mock a Vue method given that if I mock the proxied method, it ends up not being called

Mocking methods on a Vue instance during TDD

北慕城南 提交于 2020-11-24 16:11:49
问题 I'm learning TDD whilst building my Vue app, and trying to abide by the strict laws of only writing enough production code to satisfy a failing unit test. I am really enjoying this approach, but I have run into a roadblock in regards to adding methods to a Vue instance, and testing that they have been called when the event fires from the element in the template. I cannot find any suggestions as to how I can mock a Vue method given that if I mock the proxied method, it ends up not being called

Mocking methods on a Vue instance during TDD

末鹿安然 提交于 2020-11-24 16:10:35
问题 I'm learning TDD whilst building my Vue app, and trying to abide by the strict laws of only writing enough production code to satisfy a failing unit test. I am really enjoying this approach, but I have run into a roadblock in regards to adding methods to a Vue instance, and testing that they have been called when the event fires from the element in the template. I cannot find any suggestions as to how I can mock a Vue method given that if I mock the proxied method, it ends up not being called