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

Define a service using a ES6 class is not working #15

Open nicosampler opened 8 years ago

nicosampler commented 8 years ago

Hello, I want to report an issue related to define services using #ES6 clasess. Sometimes when the service have injections defined by the user, the real service is provided instead mock. this bug can be solved using injector.instantiate(providerElement, mocks); instead this injector.get(opts.providerName);

instantiate(Type, [locals]); Create a new instance of JS type. The method takes a constructor function, invokes the new operator, and supplies all of the arguments to the constructor function as specified by the constructor annotation.

Using this way, you can specify the annotations which we have from mockProvider() function

I did this PR #14 to fix the problem.

Thanks, Nico

nicosampler commented 8 years ago

Hey, i made a PR based on 1.0.8 version, when push the PR to master, i see that the current version is 1.0.11, npm is providing an older version. later i will try to solve this problem in the latest version.

tennisgent commented 8 years ago

I published 1.0.11 to npm. You should be able to update to it through npm update quickmock.

tennisgent commented 8 years ago

@nicosampler has this issue been resolved by that update above?

nicosampler commented 8 years ago

@tennisgent, no, I have resolved this problem in this PR #14, but was pushed over the previous version. After that, i couldn't apply this changes on the new version.