fix breaking tests from using ioredis with inbuilt promises

because a promise is returned from ioredis it errors in mocha as it
can't take a promise and a callback
This commit is contained in:
Henry Oswald 2019-05-30 10:58:05 +01:00
parent 47e0cb44ce
commit 2c9b222437
2 changed files with 10 additions and 4 deletions

View file

@ -48,6 +48,7 @@ describe "applyOtUpdate", ->
rclient.lrange "pending-updates-list", 0, -1, (error, [doc_id]) => rclient.lrange "pending-updates-list", 0, -1, (error, [doc_id]) =>
doc_id.should.equal "#{@project_id}:#{@doc_id}" doc_id.should.equal "#{@project_id}:#{@doc_id}"
done() done()
return null
it "should push the update into redis", (done) -> it "should push the update into redis", (done) ->
rclient.lrange redisSettings.documentupdater.key_schema.pendingUpdates({@doc_id}), 0, -1, (error, [update]) => rclient.lrange redisSettings.documentupdater.key_schema.pendingUpdates({@doc_id}), 0, -1, (error, [update]) =>
@ -58,7 +59,8 @@ describe "applyOtUpdate", ->
user_id: @user_id user_id: @user_id
} }
done() done()
return null
after (done) -> after (done) ->
async.series [ async.series [
(cb) => rclient.del "pending-updates-list", cb (cb) => rclient.del "pending-updates-list", cb
@ -107,6 +109,7 @@ describe "applyOtUpdate", ->
rclient.llen redisSettings.documentupdater.key_schema.pendingUpdates({@doc_id}), (error, len) => rclient.llen redisSettings.documentupdater.key_schema.pendingUpdates({@doc_id}), (error, len) =>
len.should.equal 0 len.should.equal 0
done() done()
return null
describe "when authorized to read-only with a comment update", -> describe "when authorized to read-only with a comment update", ->
before (done) -> before (done) ->
@ -142,6 +145,7 @@ describe "applyOtUpdate", ->
rclient.lrange "pending-updates-list", 0, -1, (error, [doc_id]) => rclient.lrange "pending-updates-list", 0, -1, (error, [doc_id]) =>
doc_id.should.equal "#{@project_id}:#{@doc_id}" doc_id.should.equal "#{@project_id}:#{@doc_id}"
done() done()
return null
it "should push the update into redis", (done) -> it "should push the update into redis", (done) ->
rclient.lrange redisSettings.documentupdater.key_schema.pendingUpdates({@doc_id}), 0, -1, (error, [update]) => rclient.lrange redisSettings.documentupdater.key_schema.pendingUpdates({@doc_id}), 0, -1, (error, [update]) =>
@ -152,7 +156,8 @@ describe "applyOtUpdate", ->
user_id: @user_id user_id: @user_id
} }
done() done()
return null
after (done) -> after (done) ->
async.series [ async.series [
(cb) => rclient.del "pending-updates-list", cb (cb) => rclient.del "pending-updates-list", cb

View file

@ -12,8 +12,9 @@ describe "Session", ->
}, (error) => }, (error) =>
throw error if error? throw error if error?
@client = RealTimeClient.connect() @client = RealTimeClient.connect()
done() return done()
return null
it "should not get disconnected", (done) -> it "should not get disconnected", (done) ->
disconnected = false disconnected = false
@client.on "disconnect", () -> @client.on "disconnect", () ->