ts-sinon
ts-sinon copied to clipboard
stubInterface is not returning promise
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!