You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So I was writing some tests for my code.
In one of my functions I was calling two APIs (for different purposes). So I needed to have two mockers. one of them(route2) should have had a matcher for the request body while the other (route1) did not. (For this, I had make two mockers with gock.New)
Then I traced an unexpected behavior. When I was calling the API to route2, the matcher registered on route1 mocker was being called.
Therefore, I looked up in the code to see the reason and I found out that there was a global variable named "Matchers" in "matcher.go". And this causes all the mockers to have the same matchers which I believe is a bug.
My test code:
This is something that has been discussed previuosly here: #26
You are very welcome to contribute. I'm open to include this capability.
I have implemented it in pook and I'm relatively happy with that design decision.
So I was writing some tests for my code.
In one of my functions I was calling two APIs (for different purposes). So I needed to have two mockers. one of them(route2) should have had a matcher for the request body while the other (route1) did not. (For this, I had make two mockers with gock.New)
Then I traced an unexpected behavior. When I was calling the API to route2, the matcher registered on route1 mocker was being called.
Therefore, I looked up in the code to see the reason and I found out that there was a global variable named "Matchers" in "matcher.go". And this causes all the mockers to have the same matchers which I believe is a bug.
My test code:
The text was updated successfully, but these errors were encountered: