 Settings = require('settings-sharelatex')
 rclient_history = require("redis-sharelatex").createClient(Settings.redis.history)
 ProjectHistoryKeys = Settings.redis.project_history.key_schema
-SandboxedModule = require('sandboxed-module')
-HistoryManagerModulePath = require('path').join __dirname, '../../../app/js/HistoryManager.js'
-ProjectManagerModulePath = require('path').join __dirname, '../../../app/js/ProjectManager.js'
-RedisManagerModulePath = require('path').join __dirname, '../../../app/js/RedisManager.js'
 
+MockProjectHistoryApi = require "./helpers/MockProjectHistoryApi"
 MockWebApi = require "./helpers/MockWebApi"
 DocUpdaterClient = require "./helpers/DocUpdaterClient"
 

					pathname: '/file-' + v
					docLines: 'a\nb'

			# Send updates in chunks to causes multiple flushes
			@ProjectManager.updateProjectWithLocks @project_id, @user_id, updates.slice(0, 250), [], (error) =>
				throw error if error?
				@ProjectManager.updateProjectWithLocks @project_id, @user_id, updates.slice(250), [], (error) =>
					throw error if error?
					setTimeout done, 2000

		it "should flush project history", ->
			@HistoryManager.flushProjectChangesAsync.calledWith(@project_id).should.equal true


	describe "with enough updates to flush to the history service", ->
		before (done) ->
			@project_id = DocUpdaterClient.randomId()
			@user_id = DocUpdaterClient.randomId()

