Skip to content

Error: Invalid Chai property: _promise #260

@Alena1985

Description

@Alena1985

The error occures when i try to test error case for async method.
So i have

it("service should catch exception when it is raised", async() => {
   const error = new Error();
   sandbox.stub(Service, "method").withArgs(arg1, arg2 ).rejects(error);//this method is called in Api.serviceMethod, it is async too
   await expect(Api.serviceMethod(arg1, arg2)).to.be.rejectedWith(error);

if instead of async/await i use just
return expect(Api.serviceMethod(arg1, arg2)).to.be.rejectedWith(error);
it works properly

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions