quickmock
quickmock copied to clipboard
Define a service using a ES6 class is not working
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
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.
I published 1.0.11
to npm. You should be able to update to it through npm update quickmock
.
@nicosampler has this issue been resolved by that update above?
@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.