CheckingUpdatesLength.coffee 711 B

123456789101112131415161718192021222324252627
  1. assert = require('chai').assert
  2. sinon = require('sinon')
  3. chai = require('chai')
  4. should = chai.should()
  5. modulePath = "../../../app/js/RedisManager.js"
  6. SandboxedModule = require('sandboxed-module')
  7. doc_id = "1234"
  8. describe 'Document Manager - getUpdatesLength ', ->
  9. beforeEach ->
  10. @llenStub = sinon.stub()
  11. @redisManager = SandboxedModule.require modulePath, requires:
  12. "redis-sharelatex":
  13. createClient:=>
  14. auth:->
  15. llen:@llenStub
  16. it "should the number of things to process in the que", (done)->
  17. @llenStub.callsArgWith(1, null, 3)
  18. @redisManager.getUpdatesLength doc_id, (err, len)=>
  19. @llenStub.calledWith("PendingUpdates:#{doc_id}").should.equal true
  20. len.should.equal 3
  21. done()