1
0
Fork 0
mirror of https://github.com/overleaf/overleaf.git synced 2025-04-22 22:46:23 +00:00

add test for ioredis monkey patching

This commit is contained in:
Brian Gough 2017-04-25 15:34:32 +01:00
parent 89397e4c50
commit 6923ca0d5f

View file

@ -75,6 +75,27 @@ describe "index", ->
assert(client instanceof @ioredis.Cluster)
client.config.should.deep.equal @cluster
describe "monkey patch ioredis exec", ->
beforeEach ->
@callback = sinon.stub()
@results = []
@multiOrig = { exec: sinon.stub().yields(null, @results)}
@client = { multi: sinon.stub().returns(@multiOrig) }
@redis._monkeyPatchIoredisExec(@client)
@multi = @client.multi()
it "should return the old redis format for an array", ->
@results[0] = [null, 42]
@results[1] = [null, "foo"]
@multi.exec @callback
@callback.calledWith(null, [42, "foo"]).should.equal true
it "should return the old redis format when there is an error", ->
@results[0] = [null, 42]
@results[1] = ["error", "foo"]
@multi.exec @callback
@callback.calledWith("error").should.equal true
describe "setting the password", ->
beforeEach ->
@standardOpts =