mirror of
https://github.com/zebrajr/express.git
synced 2025-12-06 00:19:48 +01:00
tests: fix up app.locals tests
This commit is contained in:
parent
d8ed591117
commit
7df0c840e0
|
|
@ -2,28 +2,24 @@
|
|||
|
||||
var assert = require('assert')
|
||||
var express = require('../')
|
||||
var should = require('should')
|
||||
|
||||
describe('app', function(){
|
||||
describe('.locals(obj)', function(){
|
||||
it('should merge locals', function(){
|
||||
var app = express();
|
||||
should(Object.keys(app.locals)).eql(['settings'])
|
||||
app.locals.user = 'tobi';
|
||||
app.locals.age = 2;
|
||||
should(Object.keys(app.locals)).eql(['settings', 'user', 'age'])
|
||||
assert.strictEqual(app.locals.user, 'tobi')
|
||||
assert.strictEqual(app.locals.age, 2)
|
||||
describe('.locals', function () {
|
||||
it('should default object', function () {
|
||||
var app = express()
|
||||
assert.ok(app.locals)
|
||||
assert.strictEqual(typeof app.locals, 'object')
|
||||
})
|
||||
})
|
||||
|
||||
describe('.locals.settings', function(){
|
||||
it('should expose app settings', function(){
|
||||
var app = express();
|
||||
app.set('title', 'House of Manny');
|
||||
var obj = app.locals.settings;
|
||||
should(obj).have.property('env', 'test')
|
||||
should(obj).have.property('title', 'House of Manny')
|
||||
describe('.settings', function () {
|
||||
it('should contain app settings ', function () {
|
||||
var app = express()
|
||||
app.set('title', 'Express')
|
||||
assert.ok(app.locals.settings)
|
||||
assert.strictEqual(typeof app.locals.settings, 'object')
|
||||
assert.strictEqual(app.locals.settings, app.settings)
|
||||
assert.strictEqual(app.locals.settings.title, 'Express')
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user