2014-11-25 15:26:33 +00:00
|
|
|
sinon = require('sinon')
|
|
|
|
assert = require('assert')
|
|
|
|
path = require('path')
|
|
|
|
modulePath = path.join __dirname, '../../../../../app/js/infrastructure/LockManager.js'
|
|
|
|
project_id = 1234
|
|
|
|
doc_id = 5678
|
|
|
|
SandboxedModule = require('sandboxed-module')
|
|
|
|
|
|
|
|
describe 'LockManager - releasing the lock', ()->
|
|
|
|
|
|
|
|
deleteStub = sinon.stub().callsArgWith(1)
|
|
|
|
mocks =
|
|
|
|
"logger-sharelatex": log:->
|
|
|
|
|
2017-05-04 14:22:54 +00:00
|
|
|
"./RedisWrapper":
|
|
|
|
client: ()->
|
2014-11-25 15:26:33 +00:00
|
|
|
auth:->
|
|
|
|
del:deleteStub
|
|
|
|
|
|
|
|
LockManager = SandboxedModule.require(modulePath, requires: mocks)
|
|
|
|
|
|
|
|
it 'should put a all data into memory', (done)->
|
|
|
|
LockManager.releaseLock doc_id, ->
|
2017-05-11 14:27:01 +00:00
|
|
|
deleteStub.calledWith("lock:web:{#{doc_id}}").should.equal true
|
2014-11-25 15:26:33 +00:00
|
|
|
done()
|
|
|
|
|