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