A good stub is deterministic, minimal and aligned with the real contract; anything else is a future false positive.
Writing a stub that ages well
Fix the contract
Copy the real signature. If the real method returns a Promise, the stub returns a Promise.
Hardcode the answer
No randomness, no time, no network. Same input, same output, always.
Do not assert on the stub
A stub is not a spy. If you need to check a call, you want a mock.
Keep it close to the test
A stub that lives in a shared folder drifts. Keep it next to the test that uses it.