Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Invalid Chai property: _promise #260

Open
Alena1985 opened this issue Dec 5, 2019 · 0 comments
Open

Error: Invalid Chai property: _promise #260

Alena1985 opened this issue Dec 5, 2019 · 0 comments

Comments

@Alena1985
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant