lundi 19 février 2018

sinon js stubbing getter function

Having trouble stubbing a getter method in sinon. I'm importing my class such as import * as webRpcRedux from 'web-rpc-redux'; and inside the class there are a couple getters. When I console.log the class it returns

{ ..., createRPCThunk: [Getter], ... }

However when I try to stuck it as sinon.stub(webRPCRedux, 'createRPCThunk') it returns to me TypeError: Attempted to wrap undefined property createRPCThunk as function.

I've also imported it directly as import {createRPCThunk} from ... but it also prints out the same error message. Any help would be appreciated. Thanks!

Aucun commentaire:

Enregistrer un commentaire