fix(tests): never connect to NODE_DB_URI for tests

This commit is contained in:
Matteo Pagliazzi
2016-05-18 23:50:24 +02:00
parent e98930cd4a
commit 0a14d29ebb
2 changed files with 5 additions and 3 deletions

View File

@@ -13,7 +13,9 @@ let mongooseOptions = !IS_PROD ? {} : {
replset: { socketOptions: { keepAlive: 120, connectTimeoutMS: 30000 } },
server: { socketOptions: { keepAlive: 120, connectTimeoutMS: 30000 } },
};
let db = mongoose.connect(nconf.get('NODE_DB_URI'), mongooseOptions, (err) => {
const NODE_DB_URI = nconf.get('IS_TEST') ? nconf.get('TEST_DB_URI') : nconf.get('NODE_DB_URI');
let db = mongoose.connect(NODE_DB_URI, mongooseOptions, (err) => {
if (err) throw err;
logger.info('Connected with Mongoose.');
});