Skip to content
Myr

app.js

This file

Path

test/app.js

107 lines · 2.4 KiB · JavaScript

Last changed by

fix behavior when handling request without routesDouglas Christopher Wilsonbefore adoptionbdfd288

History of this file

Take it

The walk stopped after 200 commits: lines older than 7c68822 point at it.

bump connect, mocha, and shouldJonathan Ongbefore adoption7c68822

line 1why, one step back
1

fix behavior when handling request without routesDouglas Christopher Wilsonbefore adoptionbdfd288

lines 2–4why, one step back
2var assert = require('assert')
3var express = require('..')4var request = require('supertest')

bump connect, mocha, and shouldJonathan Ongbefore adoption7c68822

lines 5–10why, one step back
5
6describe('app', function(){7 it('should inherit from event emitter', function(done){8 var app = express();9 app.on('foo', done);10 app.emit('foo');

fix behavior when handling request without routesDouglas Christopher Wilsonbefore adoptionbdfd288

lines 11–21why, one step back
11 })
1213 it('should be callable', function(){14 var app = express();15 assert(typeof app, 'function');16 })1718 it('should 404 without routes', function(done){19 request(express())20 .get('/')21 .expect(404, done);

bump connect, mocha, and shouldJonathan Ongbefore adoption7c68822

lines 22–39why, one step back
22 })
23})2425describe('app.parent', function(){26 it('should return the parent when mounted', function(){27 var app = express()28 , blog = express()29 , blogAdmin = express();3031 app.use('/blog', blog);32 blog.use('/admin', blogAdmin);3334 assert(!app.parent, 'app.parent');35 blog.parent.should.equal(app);36 blogAdmin.parent.should.equal(blog);37 })38})39

remove app.router and refactor middleware processingRoman Shtylmanbefore adoptionf41d09a

line 40why, one step back
40describe('app.mountpath', function(){

bump connect, mocha, and shouldJonathan Ongbefore adoption7c68822

lines 41–48why, one step back
41 it('should return the mounted path', function(){
42 var app = express()43 , blog = express()44 , blogAdmin = express();4546 app.use('/blog', blog);47 blog.use('/admin', blogAdmin);48

remove app.router and refactor middleware processingRoman Shtylmanbefore adoptionf41d09a

lines 49–63why, one step back
49 app.mountpath.should.equal('/');
50 blog.mountpath.should.equal('/blog');51 blogAdmin.mountpath.should.equal('/admin');52 })53})5455describe('app.router', function(){56 it('should throw with notice', function(done){57 var app = express()5859 try {60 app.router;61 } catch(err) {62 done();63 }

bump connect, mocha, and shouldJonathan Ongbefore adoption7c68822

lines 64–98why, one step back
64 })
65})6667describe('app.path()', function(){68 it('should return the canonical', function(){69 var app = express()70 , blog = express()71 , blogAdmin = express();7273 app.use('/blog', blog);74 blog.use('/admin', blogAdmin);7576 app.path().should.equal('');77 blog.path().should.equal('/blog');78 blogAdmin.path().should.equal('/blog/admin');79 })80})8182describe('in development', function(){83 it('should disable "view cache"', function(){84 process.env.NODE_ENV = 'development';85 var app = express();86 app.enabled('view cache').should.be.false;87 process.env.NODE_ENV = 'test';88 })89})9091describe('in production', function(){92 it('should enable "view cache"', function(){93 process.env.NODE_ENV = 'production';94 var app = express();95 app.enabled('view cache').should.be.true;96 process.env.NODE_ENV = 'test';97 })98})

Merge tag '3.8.0'Douglas Christopher Wilsonbefore adoptiondb4a061

lines 99–107why, one step back
99
100describe('without NODE_ENV', function(){101 it('should default to development', function(){102 process.env.NODE_ENV = '';103 var app = express();104 app.get('env').should.equal('development');105 process.env.NODE_ENV = 'test';106 })107})