2014-02-12 05:40:42 -05:00
|
|
|
assert = require('chai').assert
|
|
|
|
sinon = require('sinon')
|
|
|
|
chai = require('chai')
|
|
|
|
should = chai.should()
|
2016-01-20 12:36:06 -05:00
|
|
|
modulePath = "../../../../app/js/RedisManager.js"
|
2014-02-12 05:40:42 -05:00
|
|
|
SandboxedModule = require('sandboxed-module')
|
|
|
|
|
|
|
|
doc_id = "1234"
|
|
|
|
|
2016-01-20 12:36:06 -05:00
|
|
|
describe 'Redis Manager.getUpdatesLength ', ->
|
2014-02-12 05:40:42 -05:00
|
|
|
|
|
|
|
beforeEach ->
|
|
|
|
|
|
|
|
@llenStub = sinon.stub()
|
|
|
|
@redisManager = SandboxedModule.require modulePath, requires:
|
2016-01-20 12:36:06 -05:00
|
|
|
"./ZipManager": {}
|
|
|
|
"logger-sharelatex": {}
|
2014-10-07 07:08:36 -04:00
|
|
|
"redis-sharelatex":
|
2014-02-12 05:40:42 -05:00
|
|
|
createClient:=>
|
|
|
|
auth:->
|
|
|
|
llen:@llenStub
|
|
|
|
|
|
|
|
it "should the number of things to process in the que", (done)->
|
|
|
|
|
|
|
|
@llenStub.callsArgWith(1, null, 3)
|
|
|
|
@redisManager.getUpdatesLength doc_id, (err, len)=>
|
|
|
|
@llenStub.calledWith("PendingUpdates:#{doc_id}").should.equal true
|
|
|
|
len.should.equal 3
|
|
|
|
done()
|