config.js
This file
Path
test/config.js
94 lines · 2.3 KiB · JavaScript
Last changed by
Not known.
History of this fileTake it
The walk stopped after 200 commits: lines older than 214f913 point at it.
mergeTJ Holowaychukbefore adoption214f913
lines 1–94why, one step back12var express = require('../')3 , assert = require('assert');45describe('config', function(){6 describe('.set()', function(){7 it('should set a value', function(){8 var app = express();9 app.set('foo', 'bar').should.equal(app);10 })1112 it('should return the app when undefined', function(){13 var app = express();14 app.set('foo', undefined).should.equal(app);15 })16 })1718 describe('.get()', function(){19 it('should return undefined when unset', function(){20 var app = express();21 assert(undefined === app.get('foo'));22 })23 24 it('should otherwise return the value', function(){25 var app = express();26 app.set('foo', 'bar');27 app.get('foo').should.equal('bar');28 })2930 describe('when mounted', function(){31 it('should default to the parent app', function(){32 var app = express()33 , blog = express();3435 app.set('title', 'Express');36 app.use(blog);37 blog.get('title').should.equal('Express');38 })39 40 it('should given precedence to the child', function(){41 var app = express()42 , blog = express();4344 app.use(blog);45 app.set('title', 'Express');46 blog.set('title', 'Some Blog');4748 blog.get('title').should.equal('Some Blog');49 })50 })51 })5253 describe('.enable()', function(){54 it('should set the value to true', function(){55 var app = express();56 app.enable('tobi').should.equal(app);57 app.get('tobi').should.be.true;58 })59 })60 61 describe('.disable()', function(){62 it('should set the value to false', function(){63 var app = express();64 app.disable('tobi').should.equal(app);65 app.get('tobi').should.be.false;66 })67 })68 69 describe('.enabled()', function(){70 it('should default to false', function(){71 var app = express();72 app.enabled('foo').should.be.false;73 })74 75 it('should return true when set', function(){76 var app = express();77 app.set('foo', 'bar');78 app.enabled('foo').should.be.true;79 })80 })81 82 describe('.disabled()', function(){83 it('should default to true', function(){84 var app = express();85 app.disabled('foo').should.be.true;86 })87 88 it('should return false when set', function(){89 var app = express();90 app.set('foo', 'bar');91 app.disabled('foo').should.be.false;92 })93 })94})