[misc] tests: fix a static test

`ProjectHistoryRedisManager.queueOps` is masked and can not push
 changes into redis during the unittest.

Signed-off-by: Jakob Ackermann <das7pad@outlook.com>
This commit is contained in:
Jakob Ackermann 2019-05-16 14:58:32 +02:00
parent f9bc6dc51b
commit 4070b0ef6f

View file

@ -445,13 +445,12 @@ describe "RedisManager", ->
describe "with project history disabled", -> describe "with project history disabled", ->
beforeEach -> beforeEach ->
@rclient.rpush = sinon.stub()
@settings.apis.project_history.enabled = false @settings.apis.project_history.enabled = false
@RedisManager.getDocVersion.withArgs(@doc_id).yields(null, @version - @ops.length) @RedisManager.getDocVersion.withArgs(@doc_id).yields(null, @version - @ops.length)
@RedisManager.updateDocument @project_id, @doc_id, @lines, @version, @ops, @ranges, @updateMeta, @callback @RedisManager.updateDocument @project_id, @doc_id, @lines, @version, @ops, @ranges, @updateMeta, @callback
it "should not push the updates into the project history ops list", -> it "should not push the updates into the project history ops list", ->
@rclient.rpush.called.should.equal false @ProjectHistoryRedisManager.queueOps.called.should.equal false
it "should call the callback", -> it "should call the callback", ->
@callback @callback
@ -493,7 +492,6 @@ describe "RedisManager", ->
describe "with no updates", -> describe "with no updates", ->
beforeEach -> beforeEach ->
@rclient.rpush = sinon.stub().callsArgWith(1, null, @project_update_list_length)
@RedisManager.getDocVersion.withArgs(@doc_id).yields(null, @version) @RedisManager.getDocVersion.withArgs(@doc_id).yields(null, @version)
@RedisManager.updateDocument @project_id, @doc_id, @lines, @version, [], @ranges, @updateMeta, @callback @RedisManager.updateDocument @project_id, @doc_id, @lines, @version, [], @ranges, @updateMeta, @callback
@ -503,7 +501,7 @@ describe "RedisManager", ->
.should.equal false .should.equal false
it "should not try to enqueue project updates", -> it "should not try to enqueue project updates", ->
@rclient.rpush @ProjectHistoryRedisManager.queueOps
.called .called
.should.equal false .should.equal false