clearDocFromPendingUpdatesSetTests.coffee 866 B

12345678910111213141516171819202122232425262728
  1. sinon = require('sinon')
  2. chai = require('chai')
  3. should = chai.should()
  4. modulePath = "../../../../app/js/RedisManager"
  5. SandboxedModule = require('sandboxed-module')
  6. describe "RedisManager.clearDocFromPendingUpdatesSet", ->
  7. beforeEach ->
  8. @project_id = "project-id"
  9. @doc_id = "document-id"
  10. @callback = sinon.stub()
  11. @RedisManager = SandboxedModule.require modulePath, requires:
  12. "redis-sharelatex" : createClient: () =>
  13. @rclient ?= auth:-> # only assign one rclient
  14. "logger-sharelatex": {}
  15. @rclient.srem = sinon.stub().callsArg(2)
  16. @RedisManager.clearDocFromPendingUpdatesSet(@project_id, @doc_id, @callback)
  17. it "should get the docs with pending updates", ->
  18. @rclient.srem
  19. .calledWith("DocsWithPendingUpdates", "#{@project_id}:#{@doc_id}")
  20. .should.equal true
  21. it "should return the callback", ->
  22. @callback.called.should.equal true