1
0
Fork 0
mirror of https://github.com/overleaf/overleaf.git synced 2025-04-22 09:57:02 +00:00

fix unit tests

timekeeper must be called before SandboxedModule.require
This commit is contained in:
Brian Gough 2017-10-23 14:02:53 +01:00
parent 7c2a28c161
commit 02d3d1bd17

View file

@ -13,6 +13,7 @@ describe "RedisManager", ->
auth: () ->
exec: sinon.stub()
@rclient.multi = () => @rclient
tk.freeze(new Date())
@RedisManager = SandboxedModule.require modulePath,
requires:
"logger-sharelatex": @logger = { error: sinon.stub(), log: sinon.stub(), warn: sinon.stub() }
@ -50,6 +51,9 @@ describe "RedisManager", ->
"./Errors": Errors
globals:
JSON: @JSON = JSON
afterEach ->
tk.reset()
@doc_id = "doc-id-123"
@project_id = "project-id-123"
@ -323,12 +327,8 @@ describe "RedisManager", ->
describe "with a consistent version", ->
beforeEach ->
tk.freeze(new Date())
@RedisManager.getDocVersion.withArgs(@doc_id).yields(null, @version - @ops.length)
@RedisManager.updateDocument @doc_id, @lines, @version, @ops, @ranges, @callback
afterEach ->
tk.reset()
it "should get the current doc version to check for consistency", ->
@RedisManager.getDocVersion