From dde4738363d29d1051be3de758d16f3399876b17 Mon Sep 17 00:00:00 2001 From: Mark Hahnenberg Date: Thu, 22 Sep 2016 16:17:02 -0700 Subject: [PATCH] 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 --- .../spec/nylas-sync-worker-spec.coffee | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/internal_packages/worker-sync/spec/nylas-sync-worker-spec.coffee b/internal_packages/worker-sync/spec/nylas-sync-worker-spec.coffee index 335dd4647..82b8f7af0 100644 --- a/internal_packages/worker-sync/spec/nylas-sync-worker-spec.coffee +++ b/internal_packages/worker-sync/spec/nylas-sync-worker-spec.coffee @@ -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()