-
Notifications
You must be signed in to change notification settings - Fork 16
Remove chai-as-promised and convert tests to async/await #690
Conversation
@leplatrem would love a quick spot check on this! For the most part it's exactly the same, so just skimming the changes and checking a few spots would be really appreciated! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test/bucket_test.ts
Outdated
return getBlogBucket() | ||
.getData() | ||
.should.become({ foo: "bar" }); | ||
((await getBlogBucket().getData()) as { foo: string }).should.deep.equal({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe in this case, an intermediary variable would make sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the tests to use an intermediary variable whenever we were casting an awaited value. However, we still have tests that look like this:
(await api.fetchServerInfo()).should.deep.equal(fakeServerInfo);
Is this clear enough, or should we lift all awaited calls into variables?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this was like one of the few complex ones. Thanks for the changes!
In preparation for running tests in an actual browser environment, I've refactored all the tests that relied on
chai-as-promised
to async/await. In the process I discovered several tests that weren't waiting on promises correctly, and were throwing unhandled rejections.Removing
chai-as-promised
was necessary to get the tests passing in Intern. I'll send a future PR actually adding Intern, but I figured this would be a good PR to merge even without Intern.