config test

This commit is contained in:
Tj Holowaychuk 2011-11-08 15:40:34 -08:00
parent 8a91749e12
commit 51a5c829bb
3 changed files with 62 additions and 23 deletions

41
test/config.js Normal file
View File

@ -0,0 +1,41 @@
var express = require('../')
, assert = require('assert');
describe('config', function(){
describe('.set()', function(){
it('should set a value', function(){
var app = express();
app.set('foo', 'bar').should.equal(app);
})
})
describe('.get()', function(){
it('should return undefined when unset', function(){
var app = express();
assert(undefined === app.get('foo'));
})
it('should otherwise return the value', function(){
var app = express();
app.set('foo', 'bar');
app.get('foo').should.equal('bar');
})
})
describe('.enable()', function(){
it('should set the value to true', function(){
var app = express();
app.enable('tobi').should.equal(app);
app.get('tobi').should.be.true;
})
})
describe('.disable()', function(){
it('should set the value to false', function(){
var app = express();
app.disable('tobi').should.equal(app);
app.get('tobi').should.be.false;
})
})
})

21
test/exports.js Normal file
View File

@ -0,0 +1,21 @@
var express = require('../');
describe('exports', function(){
it('should have .version', function(){
express.should.have.property('version');
})
it('should expose connect middleware', function(){
express.should.have.property('bodyParser');
express.should.have.property('session');
express.should.have.property('static');
})
it('should expose HTTP methods', function(){
express.methods.should.be.an.instanceof(Array);
express.methods.should.contain('get');
express.methods.should.contain('put');
express.methods.should.contain('post');
})
})

View File

@ -1,23 +0,0 @@
var express = require('../');
describe('express', function(){
describe('exports', function(){
it('should have .version', function(){
express.should.have.property('version');
})
it('should expose connect middleware', function(){
express.should.have.property('bodyParser');
express.should.have.property('session');
express.should.have.property('static');
})
it('should expose HTTP methods', function(){
express.methods.should.be.an.instanceof(Array);
express.methods.should.contain('get');
express.methods.should.contain('put');
express.methods.should.contain('post');
})
})
})