bring in basic controller testing. NOTE: changes solve Mongo Session issue,
Error: Error setting TTL index on collection : sessions at /Users/weston/git/hackathon-starter/node_modules/connect-mongo/lib/connect-mongo.js:161:23 at /Users/weston/git/hackathon-starter/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1404:28 at /Users/weston/git/hackathon-starter/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1542:30 at /Users/weston/git/hackathon-starter/node_modules/mongoose/node_modules/mongodb/lib/mongodb/cursor.js:159:22 at commandHandler (/Users/weston/git/hackathon-starter/node_modules/mongoose/node_modules/mongodb/lib/mongodb/cursor.js:678:48) at /Users/weston/git/hackathon-starter/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1806:9pull/2/head
parent
400de520c6
commit
3dc900b725
5
app.js
5
app.js
|
@ -34,12 +34,13 @@ var passportConf = require('./config/passport');
|
|||
*/
|
||||
|
||||
var app = express();
|
||||
module.exports = app;
|
||||
|
||||
/**
|
||||
* Mongoose configuration.
|
||||
*/
|
||||
|
||||
mongoose.connect(secrets.db);
|
||||
mongoose.connect(secrets.url);
|
||||
mongoose.connection.on('error', function() {
|
||||
console.error('✗ MongoDB Connection Error. Please make sure MongoDB is running.');
|
||||
});
|
||||
|
@ -71,7 +72,7 @@ app.use(express.methodOverride());
|
|||
app.use(express.session({
|
||||
secret: secrets.sessionSecret,
|
||||
store: new MongoStore({
|
||||
db: mongoose.connection.db,
|
||||
url: secrets.url,
|
||||
auto_reconnect: true
|
||||
})
|
||||
}));
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"name": "hackathon-starter",
|
||||
"version": "0.0.0",
|
||||
"scripts": {
|
||||
"start": "node app.js",
|
||||
"start": "node app.js",
|
||||
"test": "mocha tests/**/*.js"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -42,6 +42,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"chai": "~1.9.0",
|
||||
"mocha": "~1.17.1"
|
||||
"mocha": "~1.17.1",
|
||||
"supertest": "~0.9.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
process.env.NODE_ENV = 'test';
|
||||
|
||||
var request = require('supertest')
|
||||
, express = require('express')
|
||||
, mocha = require('mocha')
|
||||
, app = require('../../app.js');
|
||||
|
||||
describe('GET /', function(){
|
||||
it('should return HTTP 200', function(done){
|
||||
request(app)
|
||||
.get('/')
|
||||
.expect(200, done);
|
||||
});
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue