I am writing an application using Typescript, and want to create unit tests with ts-sinon.
In their README, they state that you can stub methods like this:
import * as sinon from 'ts-sinon'
class Test {
method() { return 'original' }
}
const test = new Test();
const testStub = sinon.stubObject<Test>(test);
testStub.method.returns('stubbed');
expect(testStub.method()).to.equal('stubbed');
But this code gives me this error:
Property 'returns' does not exist on type '() => string'.
What am I doing wrong?