tennisgent / quickmock

quickmock is an simple service for automatically injecting mocks into your AngularJS unit tests using Jasmine or Mocha
http://tennisgent.github.io/quickmock
34 stars 14 forks source link

feat: don't mock dependencies that angular-mocks already handles well #6

Closed mwinche closed 7 years ago

mwinche commented 9 years ago

@tennisgent, so while I love what quickmock does, I've found it difficult to work when it tries to mock things that are already handled (mostly $httpBackend). I'd rather just use those mocks by default.

KaidenR commented 9 years ago

Zack and I were talking about this exact thing earlier today. Technically, $httpBackend doesn't completely mock all of $http, just the request part. So some people may want to fully mock out the service in their tests. For that reason this should probably be made a configuration setting.

tennisgent commented 9 years ago

I've thought of adding something like this. I've debated the value of just auto-injecting angular's built-in services, rather than requiring that they be mocked. I prefer it to tell me everytime I've forgotten to mock something (or to tell it explicitly that I don't want to mock it using mocks: { $http: quickmock.USE_ACTUAL }). However, after talking to others, I think they feel differently and would rather it not expect them to mock those services. I think I'll change how it works and do what you're suggesting.

I think I want to implement it differently though. I have a few other edge cases that your PR won't handle. Thanks for bringing this to my attention. I'm going to close this PR, but do you mind adding an issue for it and I'll fix it as soon as I can?

mwinche commented 9 years ago

@tennisgent I created the issue, close out this PR if you like.

tennisgent commented 7 years ago

Closing this pending the resolution of #7