jeudi 9 mars 2017

Using Rewire __with__ with Chai

Using Rewire with chai works with __set__ but using __with__ seems to not use the mocks I've created. How do I use the following with__with__...

const serverMocks = {
    doSomeAction: () => {
        console('test 123');
    },
    doSomeAction2: () => {
       console('test 123');
    },
};
server.__with__(serverMocks)(() => {
    chai.request(server)
       .post(muURL)
}

The original doSomeAction action in server is fired not rewired version of doSomeAction.

Thanks..

Aucun commentaire:

Enregistrer un commentaire