Created
May 24, 2019 01:59
-
-
Save ezirmusitua/02227b88b263df2603f6c13edc6edeb4 to your computer and use it in GitHub Desktop.
[Expect throw in test] Expect throw in jest #javascript #test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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