Node.js based forum software built for the modern web
fixed test cases to not throw redis error due to Reds
Julian Lam67dbdfd80d1b
diff --git a/tests/categories.js b/tests/categories.jsindex 33d816c808..5d03ebe167 100644--- a/tests/categories.js+++ b/tests/categories.js@@ -1,24 +1,25 @@// this test currently needs to talk to the redis database.// get the redis config info from root directory's config.json:-var nconf = require('nconf');-nconf.file({file: __dirname + '/../config.json'});+var path = require('path'),+ nconf = require('nconf'),+ winston = require('winston');+nconf.file({ file: path.join(__dirname, '../config.json') });process.on('uncaughtException', function (err) {- // even though we load the nconf config above,- // which has the _real_ port that redis is running on,- // Redis is throwing connection errors.- //- // Catching uncaught exceptions like this is frowned upon.- // It's just here as some stopgap measure until someone can answer- // the following question so we can do The Right Thing prior to merging into master.- //- // Where is redis attempting to connect to port 6379 in this test?- console.log(err);+ winston.error('Encountered error while running test suite: ' + err.message);});var assert = require('assert'),- RDB = require('../src/redis'),- Categories = require('../src/categories');+ RDB = require('../src/redis');++// Reds is not technically used in this test suite, but its invocation is required to stop the included+// libraries from trying to connect to the default Redis host/port+var reds = require('reds');+reds.createClient = function () {+ return reds.client || (reds.client = RDB);+};++var Categories = require('../src/categories');describe('Categories', function() {var categoryObj;