mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-28 18:12:30 +00:00
28 lines
866 B
CoffeeScript
28 lines
866 B
CoffeeScript
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:
|
|
"redis-sharelatex" : createClient: () =>
|
|
@rclient ?= auth:-> # only assign one rclient
|
|
"logger-sharelatex": {}
|
|
|
|
@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
|
|
|
|
|