ReleasingTheLock.coffee 690 B

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