2014-02-12 05:40:42 -05:00
|
|
|
sinon = require('sinon')
|
|
|
|
chai = require('chai')
|
|
|
|
should = chai.should()
|
|
|
|
modulePath = "../../../../app/js/RedisManager"
|
|
|
|
SandboxedModule = require('sandboxed-module')
|
|
|
|
|
|
|
|
describe "RedisManager.clearDocFromPendingUpdatesSet", ->
|
|
|
|
beforeEach ->
|
|
|
|
@project_id = "project-id"
|
|
|
|
@doc_id = "document-id"
|
|
|
|
@callback = sinon.stub()
|
|
|
|
@RedisManager = SandboxedModule.require modulePath, requires:
|
2014-10-07 07:08:36 -04:00
|
|
|
"redis-sharelatex" : createClient: () =>
|
2015-03-25 12:53:20 -04:00
|
|
|
@rclient ?= auth:-> # only assign one rclient
|
2014-03-21 08:41:05 -04:00
|
|
|
"logger-sharelatex": {}
|
2016-01-20 12:36:06 -05:00
|
|
|
"./ZipManager": {}
|
2014-02-12 05:40:42 -05:00
|
|
|
|
|
|
|
@rclient.srem = sinon.stub().callsArg(2)
|
|
|
|
@RedisManager.clearDocFromPendingUpdatesSet(@project_id, @doc_id, @callback)
|
|
|
|
|
|
|
|
it "should get the docs with pending updates", ->
|
|
|
|
@rclient.srem
|
|
|
|
.calledWith("DocsWithPendingUpdates", "#{@project_id}:#{@doc_id}")
|
|
|
|
.should.equal true
|
|
|
|
|
|
|
|
it "should return the callback", ->
|
|
|
|
@callback.called.should.equal true
|
|
|
|
|
|
|
|
|