overleaf/services/document-updater/test/unit/coffee/RedisManager/clearDocFromPendingUpdatesSetTests.coffee

29 lines
839 B
CoffeeScript
Raw Normal View History

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: () =>
2014-02-12 05:40:42 -05:00
@rclient = auth:->
"logger-sharelatex": {}
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