mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-31 21:21:03 -04:00
25 lines
665 B
CoffeeScript
25 lines
665 B
CoffeeScript
sinon = require('sinon')
|
|
assert = require('assert')
|
|
path = require('path')
|
|
modulePath = path.join __dirname, '../../../../../app/js/infrastructure/LockManager.js'
|
|
lockKey = "lock:web:{#{5678}}"
|
|
SandboxedModule = require('sandboxed-module')
|
|
|
|
describe 'LockManager - releasing the lock', ()->
|
|
|
|
deleteStub = sinon.stub().callsArgWith(1)
|
|
mocks =
|
|
"logger-sharelatex": log:->
|
|
|
|
"./RedisWrapper":
|
|
client: ()->
|
|
auth:->
|
|
del:deleteStub
|
|
|
|
LockManager = SandboxedModule.require(modulePath, requires: mocks)
|
|
|
|
it 'should put a all data into memory', (done)->
|
|
LockManager._releaseLock lockKey, ->
|
|
deleteStub.calledWith(lockKey).should.equal true
|
|
done()
|
|
|