mirror of
https://github.com/overleaf/overleaf.git
synced 2024-09-16 02:52:31 -04:00
Merge pull request #32 from sharelatex/hof-fix-tk-in-tests
move tk call to before sandboxed module call
This commit is contained in:
commit
a5a2efd3b3
3 changed files with 9 additions and 9 deletions
|
@ -8,6 +8,7 @@ tk = require "timekeeper"
|
||||||
|
|
||||||
describe "DocumentManager", ->
|
describe "DocumentManager", ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
|
tk.freeze(new Date())
|
||||||
@DocumentManager = SandboxedModule.require modulePath, requires:
|
@DocumentManager = SandboxedModule.require modulePath, requires:
|
||||||
"./RedisManager": @RedisManager = {}
|
"./RedisManager": @RedisManager = {}
|
||||||
"./ProjectHistoryRedisManager": @ProjectHistoryRedisManager = {}
|
"./ProjectHistoryRedisManager": @ProjectHistoryRedisManager = {}
|
||||||
|
@ -35,6 +36,9 @@ describe "DocumentManager", ->
|
||||||
@pathname = '/a/b/c.tex'
|
@pathname = '/a/b/c.tex'
|
||||||
@unflushedTime = Date.now()
|
@unflushedTime = Date.now()
|
||||||
|
|
||||||
|
afterEach ->
|
||||||
|
tk.reset()
|
||||||
|
|
||||||
describe "flushAndDeleteDoc", ->
|
describe "flushAndDeleteDoc", ->
|
||||||
describe "successfully", ->
|
describe "successfully", ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
|
@ -394,12 +398,8 @@ describe "DocumentManager", ->
|
||||||
|
|
||||||
describe "getDocAndFlushIfOld", ->
|
describe "getDocAndFlushIfOld", ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
tk.freeze(new Date())
|
|
||||||
@DocumentManager.flushDocIfLoaded = sinon.stub().callsArg(2)
|
@DocumentManager.flushDocIfLoaded = sinon.stub().callsArg(2)
|
||||||
|
|
||||||
afterEach ->
|
|
||||||
tk.reset()
|
|
||||||
|
|
||||||
describe "when the doc is in Redis", ->
|
describe "when the doc is in Redis", ->
|
||||||
describe "and has changes to be flushed", ->
|
describe "and has changes to be flushed", ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
|
|
|
@ -26,8 +26,8 @@ describe "ProjectHistoryRedisManager", ->
|
||||||
globals:
|
globals:
|
||||||
JSON: @JSON = JSON
|
JSON: @JSON = JSON
|
||||||
|
|
||||||
afterEach ->
|
afterEach ->
|
||||||
tk.reset()
|
tk.reset()
|
||||||
|
|
||||||
describe "queueOps", ->
|
describe "queueOps", ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
|
|
|
@ -55,14 +55,14 @@ describe "RedisManager", ->
|
||||||
globals:
|
globals:
|
||||||
JSON: @JSON = JSON
|
JSON: @JSON = JSON
|
||||||
|
|
||||||
afterEach ->
|
|
||||||
tk.reset()
|
|
||||||
|
|
||||||
@doc_id = "doc-id-123"
|
@doc_id = "doc-id-123"
|
||||||
@project_id = "project-id-123"
|
@project_id = "project-id-123"
|
||||||
@projectHistoryId = 123
|
@projectHistoryId = 123
|
||||||
@callback = sinon.stub()
|
@callback = sinon.stub()
|
||||||
|
|
||||||
|
afterEach ->
|
||||||
|
tk.reset()
|
||||||
|
|
||||||
describe "getDoc", ->
|
describe "getDoc", ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
@lines = ["one", "two", "three", "これは"] # include some utf8
|
@lines = ["one", "two", "three", "これは"] # include some utf8
|
||||||
|
|
Loading…
Reference in a new issue