From 8a844825a5561ff3a3804e8566a569daf9622c20 Mon Sep 17 00:00:00 2001 From: Zihua Li Date: Sat, 7 May 2016 23:45:32 +0800 Subject: [PATCH] test: update test for auth --- test/functional/auth.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/test/functional/auth.js b/test/functional/auth.js index 624f8661..5637bbb1 100644 --- a/test/functional/auth.js +++ b/test/functional/auth.js @@ -71,11 +71,21 @@ describe('auth', function () { } }); var redis = new Redis({ port: 17379, password: 'pass' }); + var pending = 2; + function check() { + if (!--pending) { + redis.disconnect(); + server.disconnect(); + done(); + } + } redis.on('error', function (error) { expect(error).to.have.property('message', 'ERR invalid password'); - redis.disconnect(); - server.disconnect(); - done(); + check(); + }); + redis.get('foo', function (err, res) { + expect(err.message).to.eql('ERR invalid password'); + check(); }); });