Skip to content

Commit 5d83e64

Browse files
author
Benjamin Coe
committed
fixed up our one commented out test, based on @erinspice's code review
1 parent 51b1ba2 commit 5d83e64

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

test/node_redis.spec.js

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -84,27 +84,22 @@ describe("The node_redis client", function () {
8484
});
8585
});
8686

87+
// TODO: we should only have a single subscription in this this
88+
// test but unsubscribing from the single channel indicates
89+
// that one subscriber still exists, let's dig into this.
8790
describe("and it's subscribed to a channel", function () {
8891
// reconnect_select_db_after_pubsub
8992
// Does not pass.
9093
// "Connection in subscriber mode, only subscriber commands may be used"
91-
xit("reconnects, unsubscribes, and can retrieve the pre-existing data", function (done) {
94+
it("reconnects, unsubscribes, and can retrieve the pre-existing data", function (done) {
9295
client.on("reconnecting", function on_recon(params) {
9396
client.on("ready", function on_connect() {
94-
async.parallel([function (cb) {
95-
client.unsubscribe("recon channel", function (err, res) {
96-
helper.isNotError()(err, res);
97-
cb();
98-
});
99-
}, function (cb) {
100-
client.get("recon 1", function (err, res) {
101-
helper.isString("one")(err, res);
102-
cb();
103-
});
104-
}], function (err, results) {
105-
client.removeListener("connect", on_connect);
106-
client.removeListener("reconnecting", on_recon);
107-
done(err);
97+
client.unsubscribe(helper.isNotError());
98+
99+
client.on('unsubscribe', function (channel, count) {
100+
// we should now be out of subscriber mode.
101+
client.set('foo', 'bar', helper.isNumber(1));
102+
return done();
108103
});
109104
});
110105
});

0 commit comments

Comments
 (0)