Преглед изворни кода

Add missing mocks to speed up tests and clean up output

James Allen пре 9 година
родитељ
комит
770b53f6af

+ 1 - 0
services/document-updater/test/unit/coffee/DispatchManager/DispatchManagerTests.coffee

@@ -13,6 +13,7 @@ describe "DispatchManager", ->
 				redis:
 					realtime: {}
 			"redis-sharelatex": @redis = {}
+			"./RateLimitManager": {}
 		@callback = sinon.stub()
 		@RateLimiter = { run: (task,cb) -> task(cb) } # run task without rate limit
 

+ 3 - 0
services/document-updater/test/unit/coffee/LockManager/CheckingTheLock.coffee

@@ -19,6 +19,9 @@ describe 'LockManager - checking the lock', ()->
 				auth:->
 				exists: existsStub
 		"./Metrics": {inc: () ->}
+		"./Profiler": class Profiler
+			log: sinon.stub().returns { end: sinon.stub() }
+			end: sinon.stub()
 	LockManager = SandboxedModule.require(modulePath, requires: mocks)
 
 	it 'should return true if the key does not exists', (done)->

+ 3 - 0
services/document-updater/test/unit/coffee/LockManager/ReleasingTheLock.coffee

@@ -26,6 +26,9 @@ describe 'LockManager - releasing the lock', ()->
 							blockingKey: ({doc_id}) -> "Blocking:#{doc_id}"
 			}
 			"./Metrics": {inc: () ->}
+			"./Profiler": class Profiler
+				log: sinon.stub().returns { end: sinon.stub() }
+				end: sinon.stub()
 		@LockManager = SandboxedModule.require(modulePath, requires: mocks)
 		@lockValue = "lock-value-stub"
 

+ 3 - 0
services/document-updater/test/unit/coffee/LockManager/getLockTests.coffee

@@ -12,6 +12,9 @@ describe 'LockManager - getting the lock', ->
 				createClient : () =>
 					auth:->
 			"./Metrics": {inc: () ->}
+			"./Profiler": class Profiler
+				log: sinon.stub().returns { end: sinon.stub() }
+				end: sinon.stub()
 		@callback = sinon.stub()
 		@doc_id = "doc-id-123"
 	

+ 3 - 0
services/document-updater/test/unit/coffee/LockManager/tryLockTests.coffee

@@ -19,6 +19,9 @@ describe 'LockManager - trying the lock', ->
 						key_schema:
 							blockingKey: ({doc_id}) -> "Blocking:#{doc_id}"
 			}
+			"./Profiler": class Profiler
+				log: sinon.stub().returns { end: sinon.stub() }
+				end: sinon.stub()
 
 		@callback = sinon.stub()
 		@doc_id = "doc-id-123"

+ 3 - 0
services/document-updater/test/unit/coffee/UpdateManager/UpdateManagerTests.coffee

@@ -22,6 +22,9 @@ describe "UpdateManager", ->
 			"settings-sharelatex": Settings = {}
 			"./DocumentManager": @DocumentManager = {}
 			"./RangesManager": @RangesManager = {}
+			"./Profiler": class Profiler
+				log: sinon.stub().returns { end: sinon.stub() }
+				end: sinon.stub()
 
 	describe "processOutstandingUpdates", ->
 		beforeEach ->