Skip to content

Instantly share code, notes, and snippets.

@ezirmusitua
Created May 24, 2019 01:59
Show Gist options
  • Save ezirmusitua/02227b88b263df2603f6c13edc6edeb4 to your computer and use it in GitHub Desktop.
Save ezirmusitua/02227b88b263df2603f6c13edc6edeb4 to your computer and use it in GitHub Desktop.
[Expect throw in test] Expect throw in jest #javascript #test
async function check() {
throw new Error('Async Function Throw Error');
}
expect('Throw Error', () => {
test('Throw', () => {
await expect(check()).rejects.toEqual(new Error('Test'))
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment