Closed darcyrush closed 5 months ago
rewiremock does not defines own helpers for this and proposing you to use something different, like sinon
.
You may tell rewritemock which solution to use via rewiremock.stubFactory
, but that's all.
import sinon from 'sinon';
import rewiremock from 'rewiremock';
const mock = sinon.spy();
const sut = rewiremock.proxy<any>(
'./path/to/sut.ts',
{
'./dependency': { mock }
}
);
sut.func();
sinon.assert.calledOnce(mock);
Thank you for the quick response and clarification, noted.
I have figured out how to mock the dependencies in my SUTs using this library, but I want to to actually use some sort of mock tracker to test calls etc. I cannot figure out how to include them from this library?