Skip to content
Myr

app.js

This file

Path

test/app.js

120 lines · 2.7 KiB · JavaScript

Last changed by

fix(refactor): prefix built-in node module importsSzymon Łągiewkabefore adoption4111359

History of this file

Take it

The walk stopped after 200 commits: lines older than 2a0c35a point at it.

Merge tag '4.17.3'Douglas Christopher Wilsonbefore adoption318fd4b

line 1why, one step back
1'use strict'

Invoke callback for sendfile when client abortsDouglas Christopher Wilsonbefore adoption2a0c35a

line 2why, one step back
2

fix(refactor): prefix built-in node module importsSzymon Łągiewkabefore adoption4111359

line 3why, one step back
3var assert = require('node:assert')

Invoke callback for sendfile when client abortsDouglas Christopher Wilsonbefore adoption2a0c35a

lines 4–15why, one step back
4var express = require('..')
5var request = require('supertest')67describe('app', function(){8 it('should inherit from event emitter', function(done){9 var app = express();10 app.on('foo', done);11 app.emit('foo');12 })1314 it('should be callable', function(){15 var app = express();

Merge tag '4.12.4'Douglas Christopher Wilsonbefore adoptionf90e045

line 16why, one step back
16 assert.equal(typeof app, 'function');

Invoke callback for sendfile when client abortsDouglas Christopher Wilsonbefore adoption2a0c35a

lines 17–35why, one step back
17 })
1819 it('should 404 without routes', function(done){20 request(express())21 .get('/')22 .expect(404, done);23 })24})2526describe('app.parent', function(){27 it('should return the parent when mounted', function(){28 var app = express()29 , blog = express()30 , blogAdmin = express();3132 app.use('/blog', blog);33 blog.use('/admin', blogAdmin);3435 assert(!app.parent, 'app.parent');

Merge tag '4.17.3'Douglas Christopher Wilsonbefore adoption318fd4b

lines 36–37why, one step back
36 assert.strictEqual(blog.parent, app)
37 assert.strictEqual(blogAdmin.parent, blog)

Invoke callback for sendfile when client abortsDouglas Christopher Wilsonbefore adoption2a0c35a

lines 38–51why, one step back
38 })
39})4041describe('app.mountpath', function(){42 it('should return the mounted path', function(){43 var admin = express();44 var app = express();45 var blog = express();46 var fallback = express();4748 app.use('/blog', blog);49 app.use(fallback);50 blog.use('/admin', admin);51

Merge tag '4.17.3'Douglas Christopher Wilsonbefore adoption318fd4b

lines 52–55why, one step back
52 assert.strictEqual(admin.mountpath, '/admin')
53 assert.strictEqual(app.mountpath, '/')54 assert.strictEqual(blog.mountpath, '/blog')55 assert.strictEqual(fallback.mountpath, '/')

Invoke callback for sendfile when client abortsDouglas Christopher Wilsonbefore adoption2a0c35a

lines 56–67why, one step back
56 })
57})5859describe('app.path()', function(){60 it('should return the canonical', function(){61 var app = express()62 , blog = express()63 , blogAdmin = express();6465 app.use('/blog', blog);66 blog.use('/admin', blogAdmin);67

Merge tag '4.17.3'Douglas Christopher Wilsonbefore adoption318fd4b

lines 68–70why, one step back
68 assert.strictEqual(app.path(), '')
69 assert.strictEqual(blog.path(), '/blog')70 assert.strictEqual(blogAdmin.path(), '/blog/admin')

Invoke callback for sendfile when client abortsDouglas Christopher Wilsonbefore adoption2a0c35a

lines 71–74why, one step back
71 })
72})7374describe('in development', function(){

Merge tag '4.17.3'Douglas Christopher Wilsonbefore adoption318fd4b

lines 75–83why, one step back
75 before(function () {
76 this.env = process.env.NODE_ENV77 process.env.NODE_ENV = 'development'78 })7980 after(function () {81 process.env.NODE_ENV = this.env82 })83

Invoke callback for sendfile when client abortsDouglas Christopher Wilsonbefore adoption2a0c35a

lines 84–85why, one step back
84 it('should disable "view cache"', function(){
85 var app = express();

Merge tag '4.17.3'Douglas Christopher Wilsonbefore adoption318fd4b

line 86why, one step back
86 assert.ok(!app.enabled('view cache'))

Invoke callback for sendfile when client abortsDouglas Christopher Wilsonbefore adoption2a0c35a

lines 87–90why, one step back
87 })
88})8990describe('in production', function(){

Merge tag '4.17.3'Douglas Christopher Wilsonbefore adoption318fd4b

lines 91–99why, one step back
91 before(function () {
92 this.env = process.env.NODE_ENV93 process.env.NODE_ENV = 'production'94 })9596 after(function () {97 process.env.NODE_ENV = this.env98 })99

Invoke callback for sendfile when client abortsDouglas Christopher Wilsonbefore adoption2a0c35a

lines 100–101why, one step back
100 it('should enable "view cache"', function(){
101 var app = express();

Merge tag '4.17.3'Douglas Christopher Wilsonbefore adoption318fd4b

line 102why, one step back
102 assert.ok(app.enabled('view cache'))

Invoke callback for sendfile when client abortsDouglas Christopher Wilsonbefore adoption2a0c35a

lines 103–106why, one step back
103 })
104})105106describe('without NODE_ENV', function(){

Merge tag '4.17.3'Douglas Christopher Wilsonbefore adoption318fd4b

lines 107–115why, one step back
107 before(function () {
108 this.env = process.env.NODE_ENV109 process.env.NODE_ENV = ''110 })111112 after(function () {113 process.env.NODE_ENV = this.env114 })115

Invoke callback for sendfile when client abortsDouglas Christopher Wilsonbefore adoption2a0c35a

lines 116–117why, one step back
116 it('should default to development', function(){
117 var app = express();

Merge tag '4.17.3'Douglas Christopher Wilsonbefore adoption318fd4b

line 118why, one step back
118 assert.strictEqual(app.get('env'), 'development')

Invoke callback for sendfile when client abortsDouglas Christopher Wilsonbefore adoption2a0c35a

lines 119–120why, one step back
119 })
120})