quickmock icon indicating copy to clipboard operation
quickmock copied to clipboard

Define a service using a ES6 class is not working

Open nicosampler opened this issue 8 years ago • 4 comments

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 avatar Mar 22 '16 19:03 nicosampler

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.

nicosampler avatar Mar 29 '16 17:03 nicosampler

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

tennisgent avatar Mar 30 '16 15:03 tennisgent

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

tennisgent avatar Aug 10 '16 16:08 tennisgent

@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.

nicosampler avatar Aug 16 '16 14:08 nicosampler