diff --git a/services/web/test/unit/coffee/Authentication/AuthenticationControllerTests.coffee b/services/web/test/unit/coffee/Authentication/AuthenticationControllerTests.coffee index 92d2a7dbdb..1d8d8ab27d 100644 --- a/services/web/test/unit/coffee/Authentication/AuthenticationControllerTests.coffee +++ b/services/web/test/unit/coffee/Authentication/AuthenticationControllerTests.coffee @@ -12,6 +12,7 @@ ObjectId = require("mongojs").ObjectId describe "AuthenticationController", -> beforeEach -> + tk.freeze(Date.now()) @AuthenticationController = SandboxedModule.require modulePath, requires: "./AuthenticationManager": @AuthenticationManager = {} "../User/UserGetter" : @UserGetter = {} @@ -39,7 +40,6 @@ describe "AuthenticationController", -> @req = new MockRequest() @res = new MockResponse() @callback = @next = sinon.stub() - tk.freeze(Date.now()) afterEach -> tk.reset() diff --git a/services/web/test/unit/coffee/History/RestoreManagerTests.coffee b/services/web/test/unit/coffee/History/RestoreManagerTests.coffee index 37fe6752e7..012c720a2b 100644 --- a/services/web/test/unit/coffee/History/RestoreManagerTests.coffee +++ b/services/web/test/unit/coffee/History/RestoreManagerTests.coffee @@ -10,6 +10,7 @@ moment = require('moment') describe 'RestoreManager', -> beforeEach -> + tk.freeze Date.now() # freeze the time for these tests @RestoreManager = SandboxedModule.require modulePath, requires: '../../infrastructure/FileWriter': @FileWriter = {} '../Uploads/FileSystemImportManager': @FileSystemImportManager = {} @@ -22,7 +23,6 @@ describe 'RestoreManager', -> @project_id = 'mock-project-id' @version = 42 @callback = sinon.stub() - tk.freeze Date.now() # freeze the time for these tests afterEach -> tk.reset() diff --git a/services/web/test/unit/coffee/Subscription/RecurlyWrapperTests.coffee b/services/web/test/unit/coffee/Subscription/RecurlyWrapperTests.coffee index d951653310..c4f6aff4c1 100644 --- a/services/web/test/unit/coffee/Subscription/RecurlyWrapperTests.coffee +++ b/services/web/test/unit/coffee/Subscription/RecurlyWrapperTests.coffee @@ -116,6 +116,7 @@ describe "RecurlyWrapper", -> apiKey: 'nonsense' privateKey: 'private_nonsense' + tk.freeze Date.now() # freeze the time for these tests @RecurlyWrapper = RecurlyWrapper = SandboxedModule.require modulePath, requires: "settings-sharelatex": @settings "logger-sharelatex": @@ -124,10 +125,11 @@ describe "RecurlyWrapper", -> log: sinon.stub() "request": sinon.stub() - describe "sign", -> + after -> + tk.reset() + describe "sign", -> before (done) -> - tk.freeze Date.now() # freeze the time for these tests @RecurlyWrapper.sign({ subscription : plan_code : "gold" @@ -137,9 +139,6 @@ describe "RecurlyWrapper", -> done() ) - after -> - tk.reset() - it "should be signed correctly", -> signed = @signature.split("|")[0] query = @signature.split("|")[1] @@ -1061,4 +1060,4 @@ describe "RecurlyWrapper", -> @RecurlyWrapper.listAccountActiveSubscriptions @user_id, @callback it "should return an empty array of subscriptions", -> - @callback.calledWith(null, []).should.equal true \ No newline at end of file + @callback.calledWith(null, []).should.equal true