|
@@ -6,12 +6,18 @@ mongojs = require "../../../app/js/mongojs"
|
|
|
ObjectId = mongojs.ObjectId
|
|
ObjectId = mongojs.ObjectId
|
|
|
Settings = require "settings-sharelatex"
|
|
Settings = require "settings-sharelatex"
|
|
|
request = require "request"
|
|
request = require "request"
|
|
|
-rclient = require("redis").createClient() # Only works locally for now
|
|
|
|
|
|
|
+console.log "hiiiiis"
|
|
|
|
|
+console.log Settings.redis.history
|
|
|
|
|
+rclient = require("redis").createClient(Settings.redis.history) # Only works locally for now
|
|
|
|
|
|
|
|
|
|
+TrackChangesApp = require "./helpers/TrackChangesApp"
|
|
|
TrackChangesClient = require "./helpers/TrackChangesClient"
|
|
TrackChangesClient = require "./helpers/TrackChangesClient"
|
|
|
MockWebApi = require "./helpers/MockWebApi"
|
|
MockWebApi = require "./helpers/MockWebApi"
|
|
|
|
|
|
|
|
describe "Appending doc ops to the history", ->
|
|
describe "Appending doc ops to the history", ->
|
|
|
|
|
+ before (done)->
|
|
|
|
|
+ TrackChangesApp.ensureRunning done
|
|
|
|
|
+
|
|
|
describe "when the history does not exist yet", ->
|
|
describe "when the history does not exist yet", ->
|
|
|
before (done) ->
|
|
before (done) ->
|
|
|
@project_id = ObjectId().toString()
|
|
@project_id = ObjectId().toString()
|
|
@@ -81,6 +87,7 @@ describe "Appending doc ops to the history", ->
|
|
|
|
|
|
|
|
describe "when the updates are recent and from the same user", ->
|
|
describe "when the updates are recent and from the same user", ->
|
|
|
beforeEach (done) ->
|
|
beforeEach (done) ->
|
|
|
|
|
+ console.log 1
|
|
|
TrackChangesClient.pushRawUpdates @project_id, @doc_id, [{
|
|
TrackChangesClient.pushRawUpdates @project_id, @doc_id, [{
|
|
|
op: [{ i: "b", p: 6 }]
|
|
op: [{ i: "b", p: 6 }]
|
|
|
meta: { ts: Date.now(), user_id: @user_id }
|
|
meta: { ts: Date.now(), user_id: @user_id }
|
|
@@ -94,9 +101,13 @@ describe "Appending doc ops to the history", ->
|
|
|
meta: { ts: Date.now(), user_id: @user_id }
|
|
meta: { ts: Date.now(), user_id: @user_id }
|
|
|
v: 8
|
|
v: 8
|
|
|
}], (error) =>
|
|
}], (error) =>
|
|
|
|
|
+ console.log 2, error
|
|
|
throw error if error?
|
|
throw error if error?
|
|
|
|
|
+ console.log 3
|
|
|
TrackChangesClient.flushAndGetCompressedUpdates @project_id, @doc_id, (error, @updates) =>
|
|
TrackChangesClient.flushAndGetCompressedUpdates @project_id, @doc_id, (error, @updates) =>
|
|
|
|
|
+ console.log 4, error
|
|
|
throw error if error?
|
|
throw error if error?
|
|
|
|
|
+ console.log 5
|
|
|
done()
|
|
done()
|
|
|
|
|
|
|
|
it "should combine all the updates into one pack", ->
|
|
it "should combine all the updates into one pack", ->
|