Skip to content

Commit

Permalink
Improve umounting test readability
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanbrainard committed Apr 20, 2017
1 parent f350457 commit e4329af
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions test/components/connect.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -915,12 +915,11 @@ describe('React', () => {

outerComponent.setRender(false)

const spy = expect.spyOn(window, 'setTimeout')

// force the refresh to happen now after it has been unmounted
after()

const spy = expect.spyOn(window, 'setTimeout')
setImmediate(() => {
spy.destroy()
expect(spy.calls.length).toBe(0)
done()
})
Expand Down Expand Up @@ -2198,11 +2197,11 @@ describe('React', () => {
<OuterComponent ref={c => outerComponent = c} />
)

const spy = expect.spyOn(console, 'error')

outerComponent.setRender(false)

const spy = expect.spyOn(console, 'error')
setImmediate(() => {
spy.destroy()
expect(spy.calls.length).toBe(0)
done()
})
Expand Down

0 comments on commit e4329af

Please sign in to comment.