update unit tests

This commit is contained in:
Brian Gough
2020-04-21 14:41:30 +01:00
parent c2e165e0eb
commit 8e210fe441
2 changed files with 14 additions and 13 deletions
@@ -4,7 +4,8 @@ chai.should()
expect = chai.expect
async = require "async"
Settings = require('settings-sharelatex')
rclient_history = require("redis-sharelatex").createClient(Settings.redis.history)
rclient_history = require("redis-sharelatex").createClient(Settings.redis.history) # note: this is track changes, not project-history
rclient_project_history = require("redis-sharelatex").createClient(Settings.redis.project_history)
rclient_du = require("redis-sharelatex").createClient(Settings.redis.documentupdater)
Keys = Settings.redis.documentupdater.key_schema
HistoryKeys = Settings.redis.history.key_schema
@@ -65,14 +66,14 @@ describe "Applying updates to a doc", ->
return null
it "should push the applied updates to the project history changes api", (done) ->
rclient_history.lrange ProjectHistoryKeys.projectHistoryOps({@project_id}), 0, -1, (error, updates) =>
rclient_project_history.lrange ProjectHistoryKeys.projectHistoryOps({@project_id}), 0, -1, (error, updates) =>
throw error if error?
JSON.parse(updates[0]).op.should.deep.equal @update.op
done()
return null
it "should set the first op timestamp", (done) ->
rclient_history.get ProjectHistoryKeys.projectHistoryFirstOpTimestamp({@project_id}), (error, result) =>
rclient_project_history.get ProjectHistoryKeys.projectHistoryFirstOpTimestamp({@project_id}), (error, result) =>
throw error if error?
result.should.be.within(@startTime, Date.now())
@firstOpTimestamp = result
@@ -90,7 +91,7 @@ describe "Applying updates to a doc", ->
return null
it "should not change the first op timestamp", (done) ->
rclient_history.get ProjectHistoryKeys.projectHistoryFirstOpTimestamp({@project_id}), (error, result) =>
rclient_project_history.get ProjectHistoryKeys.projectHistoryFirstOpTimestamp({@project_id}), (error, result) =>
throw error if error?
result.should.equal @firstOpTimestamp
done()
@@ -130,7 +131,7 @@ describe "Applying updates to a doc", ->
return null
it "should push the applied updates to the project history changes api", (done) ->
rclient_history.lrange ProjectHistoryKeys.projectHistoryOps({@project_id}), 0, -1, (error, updates) =>
rclient_project_history.lrange ProjectHistoryKeys.projectHistoryOps({@project_id}), 0, -1, (error, updates) =>
JSON.parse(updates[0]).op.should.deep.equal @update.op
done()
return null
@@ -164,7 +165,7 @@ describe "Applying updates to a doc", ->
return null
it "should push the applied updates to the project history changes api", (done) ->
rclient_history.lrange ProjectHistoryKeys.projectHistoryOps({@project_id}), 0, -1, (error, updates) =>
rclient_project_history.lrange ProjectHistoryKeys.projectHistoryOps({@project_id}), 0, -1, (error, updates) =>
JSON.parse(updates[0]).op.should.deep.equal @update.op
done()
return null
@@ -2,7 +2,7 @@ sinon = require "sinon"
chai = require("chai")
chai.should()
Settings = require('settings-sharelatex')
rclient_history = require("redis-sharelatex").createClient(Settings.redis.history)
rclient_project_history = require("redis-sharelatex").createClient(Settings.redis.project_history)
ProjectHistoryKeys = Settings.redis.project_history.key_schema
MockProjectHistoryApi = require "./helpers/MockProjectHistoryApi"
@@ -30,7 +30,7 @@ describe "Applying updates to a project's structure", ->
setTimeout done, 200
it "should push the applied file renames to the project history api", (done) ->
rclient_history.lrange ProjectHistoryKeys.projectHistoryOps({@project_id}), 0, -1, (error, updates) =>
rclient_project_history.lrange ProjectHistoryKeys.projectHistoryOps({@project_id}), 0, -1, (error, updates) =>
throw error if error?
update = JSON.parse(updates[0])
@@ -61,7 +61,7 @@ describe "Applying updates to a project's structure", ->
return null
it "should push the applied doc renames to the project history api", (done) ->
rclient_history.lrange ProjectHistoryKeys.projectHistoryOps({@project_id}), 0, -1, (error, updates) =>
rclient_project_history.lrange ProjectHistoryKeys.projectHistoryOps({@project_id}), 0, -1, (error, updates) =>
throw error if error?
update = JSON.parse(updates[0])
@@ -97,7 +97,7 @@ describe "Applying updates to a project's structure", ->
return null
it "should push the applied doc renames to the project history api", (done) ->
rclient_history.lrange ProjectHistoryKeys.projectHistoryOps({@project_id}), 0, -1, (error, updates) =>
rclient_project_history.lrange ProjectHistoryKeys.projectHistoryOps({@project_id}), 0, -1, (error, updates) =>
throw error if error?
update = JSON.parse(updates[0])
@@ -141,7 +141,7 @@ describe "Applying updates to a project's structure", ->
return null
it "should push the applied doc renames to the project history api", (done) ->
rclient_history.lrange ProjectHistoryKeys.projectHistoryOps({@project_id}), 0, -1, (error, updates) =>
rclient_project_history.lrange ProjectHistoryKeys.projectHistoryOps({@project_id}), 0, -1, (error, updates) =>
throw error if error?
update = JSON.parse(updates[0])
@@ -194,7 +194,7 @@ describe "Applying updates to a project's structure", ->
return null
it "should push the file addition to the project history api", (done) ->
rclient_history.lrange ProjectHistoryKeys.projectHistoryOps({@project_id}), 0, -1, (error, updates) =>
rclient_project_history.lrange ProjectHistoryKeys.projectHistoryOps({@project_id}), 0, -1, (error, updates) =>
throw error if error?
update = JSON.parse(updates[0])
@@ -222,7 +222,7 @@ describe "Applying updates to a project's structure", ->
return null
it "should push the doc addition to the project history api", (done) ->
rclient_history.lrange ProjectHistoryKeys.projectHistoryOps({@project_id}), 0, -1, (error, updates) =>
rclient_project_history.lrange ProjectHistoryKeys.projectHistoryOps({@project_id}), 0, -1, (error, updates) =>
throw error if error?
update = JSON.parse(updates[0])