From 1179518f4e1f8a76809d01ca44fb53a5d347304e Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Tue, 15 Aug 2017 14:35:02 +0100 Subject: [PATCH] unit test for sync conflict --- .../coffee/Compile/ClsiManagerTests.coffee | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/services/web/test/UnitTests/coffee/Compile/ClsiManagerTests.coffee b/services/web/test/UnitTests/coffee/Compile/ClsiManagerTests.coffee index 6b4727f7a7..3799537328 100644 --- a/services/web/test/UnitTests/coffee/Compile/ClsiManagerTests.coffee +++ b/services/web/test/UnitTests/coffee/Compile/ClsiManagerTests.coffee @@ -103,6 +103,25 @@ describe "ClsiManager", -> it "should call the callback with a failure statue", -> @callback.calledWith(null, @status).should.equal true + describe "with a sync conflict", -> + beforeEach -> + @ClsiManager.sendRequestOnce = sinon.stub() + @ClsiManager.sendRequestOnce.withArgs(@project_id, @user_id, {syncType:"full"}).callsArgWith(3, null, @status = "success") + @ClsiManager.sendRequestOnce.withArgs(@project_id, @user_id, {}).callsArgWith(3, null, "conflict") + @ClsiManager.sendRequest @project_id, @user_id, {}, @callback + + it "should call the sendRequestOnce method twice", -> + @ClsiManager.sendRequestOnce.calledTwice.should.equal true + + it "should call the sendRequestOnce method once with syncType:full", -> + @ClsiManager.sendRequestOnce.withArgs(@project_id, @user_id, {syncType:"full"}).calledOnce.should.equal true + + it "should call the sendRequestOnce method once without syncType:full", -> + @ClsiManager.sendRequestOnce.withArgs(@project_id, @user_id, {}).calledOnce.should.equal true + + it "should call the callback with a success status", -> + @callback.calledWith(null, @status, ).should.equal true + describe "deleteAuxFiles", -> beforeEach -> @ClsiManager._makeRequest = sinon.stub().callsArg(2)