exports.js
This file
Path
test/exports.js
61 lines · 1.5 KiB · JavaScript
Last changed by
Not known.
History of this fileTake it
The walk stopped after 200 commits: lines older than 6bc7574 point at it.
docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574
lines 1–61why, one step back12var express = require('../');3var request = require('supertest');4var should = require('should');56describe('exports', function(){7 it('should expose Router', function(){8 express.Router.should.be.a.Function;9 })1011 it('should expose the application prototype', function(){12 express.application.set.should.be.a.Function;13 })1415 it('should expose the request prototype', function(){16 express.request.accepts.should.be.a.Function;17 })1819 it('should expose the response prototype', function(){20 express.response.send.should.be.a.Function;21 })2223 it('should permit modifying the .application prototype', function(){24 express.application.foo = function(){ return 'bar'; };25 express().foo().should.equal('bar');26 })2728 it('should permit modifying the .request prototype', function(done){29 express.request.foo = function(){ return 'bar'; };30 var app = express();3132 app.use(function(req, res, next){33 res.end(req.foo());34 });3536 request(app)37 .get('/')38 .expect('bar', done);39 })4041 it('should permit modifying the .response prototype', function(done){42 express.response.foo = function(){ this.send('bar'); };43 var app = express();4445 app.use(function(req, res, next){46 res.foo();47 });4849 request(app)50 .get('/')51 .expect('bar', done);52 })5354 it('should throw on old middlewares', function(){55 var error;56 try { express.bodyParser; } catch (e) { error = e; }57 should(error).have.property('message');58 error.message.should.containEql('middleware');59 error.message.should.containEql('bodyParser');60 })61})