-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #19 This is a **BREAKING** change that upgrades the underlying `redis` client to v4, which had so many [breaking changes][1], that it's infeasible to maintain backwards-compatibility with v3. If consumers need to use v3, they are advised to pin their version of `sharedb-redis-pubsub` to v4. This change adapts to the breakages: - wrap the returned `Promise`s in callbacks - actively connect the `client`, which no longer auto-connects - move the `message` event handler into the subscription callback - adapt to the new call signature of `client.eval()` [1]: https://github.com/redis/node-redis/blob/HEAD/docs/v3-to-v4.md
- Loading branch information
1 parent
fa5921e
commit 13c46af
Showing
3 changed files
with
90 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,44 @@ | ||
var redisPubSub = require('../index'); | ||
var redis = require('redis'); | ||
var runTestSuite = require('sharedb/test/pubsub'); | ||
|
||
require('sharedb/test/pubsub')(function(callback) { | ||
callback(null, redisPubSub()); | ||
describe('default options', function() { | ||
runTestSuite(function(callback) { | ||
callback(null, redisPubSub()); | ||
}); | ||
}); | ||
|
||
describe('unconnected client', function() { | ||
runTestSuite(function(callback) { | ||
callback(null, redisPubSub({ | ||
client: redis.createClient() | ||
})); | ||
}); | ||
}); | ||
|
||
describe('connected client', function() { | ||
var client; | ||
|
||
beforeEach(function(done) { | ||
client = redis.createClient(); | ||
client.connect().then(function() { | ||
done(); | ||
}, done); | ||
}); | ||
|
||
runTestSuite(function(callback) { | ||
callback(null, redisPubSub({ | ||
client: client | ||
})); | ||
}); | ||
}); | ||
|
||
describe('connecting client', function() { | ||
runTestSuite(function(callback) { | ||
var client = redis.createClient(); | ||
client.connect(); | ||
callback(null, redisPubSub({ | ||
client: client | ||
})); | ||
}); | ||
}); |