goldbergyoni / goldbergyoni/javascript-testing-best-practices

Avoid mocks in favor of stubs and spies

Open
#214 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
24.6k
Forks
2.1k
PR merge metrics
No merged PRs in 30d

Description

# Avoid mocks in favor of stubs and spies

Correct me if im wrong but i was reading this paper ([Mocks Aren't Stubs](https://martinfowler.com/articles/mocksArentStubs.html)) you provided about test doubles, and then i compared it to what you wrote.

In the paper they say the following :

`Mock objects always use behavior verification, a stub can go either way. Meszaros refers to stubs that use behavior verification as a Test Spy. The difference is in how exactly the double runs and verifies and I'll leave that for you to explore on your own.`

but what is written on your documentation is ( i think maybe i didn't understand what you said ) is not the same where mocks are pushed as they don't follow behavior verification and that stubs are fully designed for behavior verification but in reality they can go either way (stubs).

So can you please provide a clearer answer about that section because im kind of confused

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.