If I stub my function like so:
const sandbox: sinon.SinonSandbox = sinon.createSandbox();
getInfoStub = sandbox.stub(ytdl, 'getInfo').withArgs(videoUrl).resolves(videoInfo);
And then I try to do getInfoStub.restore() I get a TypeError: getInfoStub.restore is not a function
However when I remove the option .withArgs(videoUrl) restore works fine:
const sandbox: sinon.SinonSandbox = sinon.createSandbox();
getInfoStub = sandbox.stub(ytdl, 'getInfo').resolves(videoInfo);
What's the deal with withArgs that breaks sinon ?