Skip to content

Commit

Permalink
add coverage for wait-for-element-to-be-removed
Browse files Browse the repository at this point in the history
  • Loading branch information
kentcdodds committed Mar 4, 2020
1 parent 4a68f39 commit 393ba2f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/__tests__/wait-for-element-to-be-removed.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,18 @@ test("doesn't change jest's timers value when importing the module", () => {

expect(window.setTimeout._isMockFunction).toEqual(true)
})

test('rethrows non-testing-lib errors', () => {
let throwIt = false
const div = document.createElement('div')
const error = new Error('my own error')
return expect(
waitForElementToBeRemoved(() => {
if (throwIt) {
throw error
}
throwIt = true
return div
}),
).rejects.toBe(error)
})

0 comments on commit 393ba2f

Please sign in to comment.