Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
sangeetha5491 committed May 12, 2020
1 parent 4480ed3 commit 67b4e3f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test/journalling.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,19 @@ describe('Polling for journal events', () => {
expect(error.code).toBe('ERROR_GET_JOURNAL_DATA')
})
jest.advanceTimersByTime(0)
await Promise.resolve()
expect(journalling.subject.observers.length).toBe(1)
expect(journalling.__checkPollingCondition).toHaveBeenCalledTimes(1)
jest.advanceTimersByTime(0)
await Promise.resolve()
expect(eventsClient.getEventsFromJournal).toHaveBeenCalledTimes(1)
await Promise.resolve()
expect(journalling.subject.observers.length).toBe(0)
jest.advanceTimersByTime(2000)
await Promise.resolve()
expect(eventsClient.getEventsFromJournal).toHaveBeenCalledTimes(1)
expect(journalling.__checkPollingCondition).toHaveBeenCalledTimes(2)
jest.advanceTimersByTime(2000)
await Promise.resolve()
expect(eventsClient.getEventsFromJournal).toHaveBeenCalledTimes(1)
expect(journalling.__checkPollingCondition).toHaveBeenCalledTimes(3)
jest.clearAllTimers()
Expand Down

0 comments on commit 67b4e3f

Please sign in to comment.