mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #627 from sharelatex/hof-fix-tk-in-tests
move tk call to before sandboxed module call
This commit is contained in:
commit
1f19e0e7da
3 changed files with 7 additions and 8 deletions
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
@callback.calledWith(null, []).should.equal true
|
||||
|
|
Loading…
Reference in a new issue