Can I put value in stub.returnsThis() when substituting method during test?

26 Views Asked by At

If I have some class:

class ServiceClient {

  setVaultClient(vaultClient) {
        this.vaultClientObj = vaultClient;
    }
  
}

and I want to mock the result of this method (means I want this.vaultClientObj to be what I say, but not the real one) - how can I do that? I am trying with stub.returnsThis() and I wonder if I can put some specific value - not just to be returned this, but to be returned this.vaultClientObj value that i want.

0

There are 0 best solutions below