我在尝试用诺德.js语学习TDD。 我认为,由于再保护者,我只指挥了hang。 以<代码>ctrl+C对这一过程进行杀 最后,产出一米(通过100%3次测试)。
导致<代码>expresso的 我可以做些什么?
我期待着:
// Module dependencies.
var auth = require( connect-auth ),
RedisStore = require( connect-redis );
var express = require( express );
var app = module.exports = express.createServer();
// Configuration
app.configure(function(){
app.set( views , __dirname + /views );
app.set( view engine , jade );
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(express.cookieParser());
app.use(express.session({ store: new RedisStore, secret: "secret goes here" }));
app.use(app.router);
app.use(express.static(__dirname + /public ));
});
app.configure( development , function(){
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
});
app.configure( production , function(){
app.use(express.errorHandler());
});
// Routes
app.get( / , function(req, res){
res.render( index , {
title: Orchestrate
});
});
app.get( /login , function(req, res){
res.render( user/login , {
title: Login
});
});
app.get( /register , function(req, res){
res.render( user/login , {
title: Register
});
});
// Only listen on $ node app.js
if (!module.parent) {
app.listen(3000);
console.log("Express server listening on port %d", app.address().port);
}
我的测试:
// Run $ expresso
/**
* Module dependencies.
*/
var app = require( ../app ),
assert = require( assert );
module.exports = {
GET / : function(){
assert.response(app,
{ url: / },
{ status: 200, headers: { Content-Type : text/html; charset=utf-8 }},
function(res){
assert.includes(res.body, <title>Orchestrate</title> );
});
},
GET /login : function(){
assert.response(app,
{ url: /login },
{ status: 200, headers: { Content-Type : text/html; charset=utf-8 }},
function(res){
assert.includes(res.body, <title>Login</title> );
});
},
GET /register : function(){
assert.response(app,
{ url: /register },
{ status: 200, headers: { Content-Type : text/html; charset=utf-8 }},
function(res){
assert.includes(res.body, <title>Register</title> );
});
}
iii