lundi 25 juin 2018

Mock with sinon injection services in node.js

I have the following class in a parent project (parent project will be a module in child project):

export default class testService {

    constructor({loggerFactory,childService}) {
        this.logger = loggerFactory.logger
        this.child = childService;
    }
}

when I run test the test has been failed because the childservice does not exist. the service is exist only if I open the child project that includes the parent module in the node modules

so my question is how can i mock that to prevent failure in test

Aucun commentaire:

Enregistrer un commentaire