Skip to content

Conversation

fregante
Copy link
Contributor

@fregante fregante commented Apr 7, 2021

Fixes #251

Follows and is based on #253

test/api-test.js Outdated
});

await t.throwsAsync(() => service.makeApiRequest('notifications'), 'client error');
await t.throwsAsync(() => service.makeApiRequest('notifications'), {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the () => part.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can t.throwsAsync catch and compare the error if the call throws before its result is passed to t.throwsAsync? 🤔

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't throw. makeApiRequest returns a promise. You pass a promise to throwsAsync and it checks whether it rejects or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Promises, how do they work

@fregante fregante marked this pull request as ready for review April 7, 2021 05:36
@fregante
Copy link
Contributor Author

fregante commented Apr 7, 2021

@notlmn It turns out most of the changes required for ESM support were done by XO in #253

It pays to update the dependencies!

@sindresorhus sindresorhus merged commit f1facf6 into sindresorhus:main Apr 7, 2021
@fregante fregante deleted the avando branch April 7, 2021 05:55
@notlmn
Copy link
Collaborator

notlmn commented Apr 8, 2021

@fregante thank you for this while I am MIA out of OSS!

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

Successfully merging this pull request may close these issues.

Update tests to use AVA 3

3 participants