mirror of
https://github.com/zebrajr/express.git
synced 2025-12-06 12:19:51 +01:00
Added res.locals(obj) test
This commit is contained in:
parent
2937309f00
commit
2c0e13b513
25
test/res.locals.js
Normal file
25
test/res.locals.js
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
|
||||
var express = require('../')
|
||||
, request = require('./support/http');
|
||||
|
||||
describe('res', function(){
|
||||
describe('.locals(obj)', function(){
|
||||
it('should merge locals', function(done){
|
||||
var app = express();
|
||||
|
||||
app.use(function(req, res){
|
||||
Object.keys(res.locals).should.eql([]);
|
||||
res.locals({ user: 'tobi', age: 1 });
|
||||
res.locals.user.should.equal('tobi');
|
||||
res.locals.age.should.equal(1);
|
||||
res.end();
|
||||
});
|
||||
|
||||
request(app)
|
||||
.get('/')
|
||||
.end(function(res){
|
||||
done();
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
Loading…
Reference in New Issue
Block a user