ttarnowski/ts-sinon

How to call subInterface from sandbox ?

Closed this issue · 1 comments

I'm using ts-sinon for stubing interface function. But I couldn't do this with sandbox ? I want to call sandbox.restore() after each test case.
Is this possible by ts-sinon ?

import * as sinon from "ts-sinon";
const sandbox: sinon.default.SinonSandbox = sinon.default.createSandbox();

sandbox.stubInterface<InterfaceHere>({ method: "" }); // can't stub interface's function with sandbox

Thanks in advance !

I'm afraid that feature is not really available at the moment. Sandboxes are usually used with static / global objects and I'm not entirely sure it would have an use with ts-sinon that produces the stubs - return new instances instead of stubbing the behaviour of existing objects.

If you give me a good use case of sandbox with the interfaces I can consider adding that feature.