Fix broken test

Summary:
Fixes a test that was broken due to my unfamiliarity with
CoffeeScript :-/

Test Plan: Tests

Reviewers: bengotow

Reviewed By: bengotow

Subscribers: juan

Differential Revision: https://phab.nylas.com/D3302
This commit is contained in:
Mark Hahnenberg 2016-09-22 16:17:02 -07:00
parent 6051512276
commit dde4738363

View file

@ -106,26 +106,26 @@ describe "NylasSyncWorker", ->
spyOn(Math, 'random').andReturn(1.0)
@worker.start()
expectThings = (resumeCallCount) ->
expectThings = (resumeCallCount, randomCallCount) =>
expect(@worker.resume.callCount).toBe(resumeCallCount)
expect(Math.random.callCount).toBe(resumeCallCount)
expect(Math.random.callCount).toBe(randomCallCount)
expect(@worker.resume.callCount).toBe(1)
simulateNetworkFailure(); expectThings(1)
advanceClock(4000); expectThings(2)
simulateNetworkFailure(); expectThings(2)
advanceClock(4000); expectThings(2)
advanceClock(4000); expectThings(3)
simulateNetworkFailure(); expectThings(3)
advanceClock(4000); expectThings(3)
advanceClock(4000); expectThings(3)
advanceClock(4000); expectThings(4)
simulateNetworkFailure(); expectThings(4)
advanceClock(4000); expectThings(4)
advanceClock(4000); expectThings(4)
advanceClock(4000); expectThings(4)
advanceClock(4000); expectThings(4)
advanceClock(4000); expectThings(5)
expect(@worker.resume.callCount).toBe(1, 1)
simulateNetworkFailure(); expectThings(1, 1)
advanceClock(4000); expectThings(2, 1)
simulateNetworkFailure(); expectThings(2, 2)
advanceClock(4000); expectThings(2, 2)
advanceClock(4000); expectThings(3, 2)
simulateNetworkFailure(); expectThings(3, 3)
advanceClock(4000); expectThings(3, 3)
advanceClock(4000); expectThings(3, 3)
advanceClock(4000); expectThings(4, 3)
simulateNetworkFailure(); expectThings(4, 4)
advanceClock(4000); expectThings(4, 4)
advanceClock(4000); expectThings(4, 4)
advanceClock(4000); expectThings(4, 4)
advanceClock(4000); expectThings(4, 4)
advanceClock(4000); expectThings(5, 4)
it "handles the request as a failure if we try and grab labels or folders without an 'inbox'", ->
spyOn(@worker, 'resume').andCallThrough()