Skip to content
This repository has been archived by the owner on Nov 3, 2020. It is now read-only.

Commit

Permalink
Fix error: "state update on unmounted component"
Browse files Browse the repository at this point in the history
  • Loading branch information
beausmith committed Jan 16, 2020
1 parent ba15a12 commit 8d293b3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/AppRefresh.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ it('Refresh window and expect to be on same contest', async () => {

// Go to First Contest
await wait(() => fireEvent.click(getByText('Start Voting')))
advanceTimers()

// ====================== END CONTEST SETUP ====================== //

Expand All @@ -58,7 +57,7 @@ it('Refresh window and expect to be on same contest', async () => {

// advance time by CARD_LONG_VALUE_WRITE_DELAY to let background interval write to card
advanceBy(1000)
advanceTimers()
await wait()

unmount()
;({ getByText, unmount } = render(
Expand All @@ -69,6 +68,7 @@ it('Refresh window and expect to be on same contest', async () => {

// App is on first contest
await wait(() => getByText(presidentContest.title))

// First candidate selected
expect(getByText(candidate0).closest('button')!.dataset.selected).toBe('true')
})

0 comments on commit 8d293b3

Please sign in to comment.