From 62a10f25f27802343bfac135275a8720226eac2e Mon Sep 17 00:00:00 2001 From: Hayden Faulds Date: Tue, 5 Jun 2018 13:54:05 +0100 Subject: [PATCH] move tk call to before sandboxed module call --- .../coffee/DocumentManager/DocumentManagerTests.coffee | 8 ++++---- .../ProjectHistoryRedisManagerTests.coffee | 4 ++-- .../unit/coffee/RedisManager/RedisManagerTests.coffee | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/services/document-updater/test/unit/coffee/DocumentManager/DocumentManagerTests.coffee b/services/document-updater/test/unit/coffee/DocumentManager/DocumentManagerTests.coffee index d7cd18630a..c52bb4b30d 100644 --- a/services/document-updater/test/unit/coffee/DocumentManager/DocumentManagerTests.coffee +++ b/services/document-updater/test/unit/coffee/DocumentManager/DocumentManagerTests.coffee @@ -8,6 +8,7 @@ tk = require "timekeeper" describe "DocumentManager", -> beforeEach -> + tk.freeze(new Date()) @DocumentManager = SandboxedModule.require modulePath, requires: "./RedisManager": @RedisManager = {} "./ProjectHistoryRedisManager": @ProjectHistoryRedisManager = {} @@ -35,6 +36,9 @@ describe "DocumentManager", -> @pathname = '/a/b/c.tex' @unflushedTime = Date.now() + afterEach -> + tk.reset() + describe "flushAndDeleteDoc", -> describe "successfully", -> beforeEach -> @@ -394,12 +398,8 @@ describe "DocumentManager", -> describe "getDocAndFlushIfOld", -> beforeEach -> - tk.freeze(new Date()) @DocumentManager.flushDocIfLoaded = sinon.stub().callsArg(2) - afterEach -> - tk.reset() - describe "when the doc is in Redis", -> describe "and has changes to be flushed", -> beforeEach -> diff --git a/services/document-updater/test/unit/coffee/ProjectHistoryRedisManager/ProjectHistoryRedisManagerTests.coffee b/services/document-updater/test/unit/coffee/ProjectHistoryRedisManager/ProjectHistoryRedisManagerTests.coffee index 349d3623e6..aa777b40d6 100644 --- a/services/document-updater/test/unit/coffee/ProjectHistoryRedisManager/ProjectHistoryRedisManagerTests.coffee +++ b/services/document-updater/test/unit/coffee/ProjectHistoryRedisManager/ProjectHistoryRedisManagerTests.coffee @@ -26,8 +26,8 @@ describe "ProjectHistoryRedisManager", -> globals: JSON: @JSON = JSON - afterEach -> - tk.reset() + afterEach -> + tk.reset() describe "queueOps", -> beforeEach -> diff --git a/services/document-updater/test/unit/coffee/RedisManager/RedisManagerTests.coffee b/services/document-updater/test/unit/coffee/RedisManager/RedisManagerTests.coffee index 42d06d743a..4f6c24720e 100644 --- a/services/document-updater/test/unit/coffee/RedisManager/RedisManagerTests.coffee +++ b/services/document-updater/test/unit/coffee/RedisManager/RedisManagerTests.coffee @@ -55,14 +55,14 @@ describe "RedisManager", -> globals: JSON: @JSON = JSON - afterEach -> - tk.reset() - @doc_id = "doc-id-123" @project_id = "project-id-123" @projectHistoryId = 123 @callback = sinon.stub() + afterEach -> + tk.reset() + describe "getDoc", -> beforeEach -> @lines = ["one", "two", "three", "これは"] # include some utf8