Skip to content

stubInterface is not returning promise #254

@jose-roberto-abreu

Description

@jose-roberto-abreu

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions