ReleasingTheLock.coffee 665 B

12345678910111213141516171819202122232425
  1. sinon = require('sinon')
  2. assert = require('assert')
  3. path = require('path')
  4. modulePath = path.join __dirname, '../../../../../app/js/infrastructure/LockManager.js'
  5. lockKey = "lock:web:{#{5678}}"
  6. SandboxedModule = require('sandboxed-module')
  7. describe 'LockManager - releasing the lock', ()->
  8. deleteStub = sinon.stub().callsArgWith(1)
  9. mocks =
  10. "logger-sharelatex": log:->
  11. "./RedisWrapper":
  12. client: ()->
  13. auth:->
  14. del:deleteStub
  15. LockManager = SandboxedModule.require(modulePath, requires: mocks)
  16. it 'should put a all data into memory', (done)->
  17. LockManager._releaseLock lockKey, ->
  18. deleteStub.calledWith(lockKey).should.equal true
  19. done()