Mocking in unit testing with Sinon

I’ve noticed that a lot of tests using sinon. It’s fine, although in JS you can mock with myObject[‘myProp’] = myMockFn. But please test against APIs (private is fine), but not control flow. It’s crazzy hard to undertand and maitain test with stubGetFileStat.onCall(0).resolves(folderB); assertions. I’m trying to simplify control flow and test start failing because they are testing that control flow is complex.

[original thread by Anton Kosyakov]