ts-sinon icon indicating copy to clipboard operation
ts-sinon copied to clipboard

stubInterface is not returning promise

Open jose-roberto-abreu opened this issue 2 years ago • 0 comments

Hello everyone,

I need your help checking what's happening with the following test:

it("on successful creation delivers created service", async function() {
        let anyService = new Service(...)
        let serviceRepositorySpy = stubInterface<IServicesRepository>({createService: Promise.resolve(anyService)})
        let createServiceUseCase = new CreateServiceUseCase(serviceRepositorySpy);
        
        await expect(createServiceUseCase.createService(...)).to.eventually.eql(anyService)
    });

But looks like the promise that I stubbed is not getting returned, but rather is returning undefined.

Is there anything missing? Does stubInterface allow stubbing responses or should only be used to check the call count (because checking the call count is working fine for me)?

Thanks, this is great library!

jose-roberto-abreu avatar Apr 01 '22 04:04 jose-roberto-abreu