Skip to content
Myr

config.js

This file

Path

test/config.js

162 lines · 4.4 KiB · JavaScript

Last changed by

Merge tag '3.20.0'Douglas Christopher Wilsonbefore adoption531f024

History of this file

Take it

The walk stopped after 200 commits: lines older than 6bc7574 point at it.

docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574

line 1why, one step back
1

Merge tag '3.20.0'Douglas Christopher Wilsonbefore adoption531f024

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

docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574

line 4why, one step back
4

Merge tag '3.20.0'Douglas Christopher Wilsonbefore adoption531f024

lines 5–7why, one step back
5describe('config', function () {
6 describe('.set()', function () {7 it('should set a value', function () {

docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574

line 8why, one step back
8 var app = express();

Merge tag '3.20.0'Douglas Christopher Wilsonbefore adoption531f024

lines 9–10why, one step back
9 app.set('foo', 'bar');
10 assert.equal(app.get('foo'), 'bar');

docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574

lines 11–12why, one step back
11 })
12

Merge tag '3.20.0'Douglas Christopher Wilsonbefore adoption531f024

line 13why, one step back
13 it('should return the app', function () {

docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574

line 14why, one step back
14 var app = express();

Merge tag '3.20.0'Douglas Christopher Wilsonbefore adoption531f024

line 15why, one step back
15 assert.equal(app.set('foo', 'bar'), app);

docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574

lines 16–17why, one step back
16 })
17

Merge tag '3.20.0'Douglas Christopher Wilsonbefore adoption531f024

lines 18–22why, one step back
18 it('should return the app when undefined', function () {
19 var app = express();20 assert.equal(app.set('foo', undefined), app);21 })22

docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574

lines 23–24why, one step back
23 describe('"etag"', function(){
24 it('should throw on bad value', function(){

Merge tag '3.20.0'Douglas Christopher Wilsonbefore adoption531f024

lines 25–26why, one step back
25 var app = express();
26 assert.throws(app.set.bind(app, 'etag', 42), /unknown value/);

docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574

lines 27–32why, one step back
27 })
2829 it('should set "etag fn"', function(){30 var app = express()31 var fn = function(){}32 app.set('etag', fn)

Merge tag '3.20.0'Douglas Christopher Wilsonbefore adoption531f024

line 33why, one step back
33 assert.equal(app.get('etag fn'), fn)

docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574

lines 34–41why, one step back
34 })
35 })3637 describe('"trust proxy"', function(){38 it('should set "trust proxy fn"', function(){39 var app = express()40 var fn = function(){}41 app.set('trust proxy', fn)

Merge tag '3.20.0'Douglas Christopher Wilsonbefore adoption531f024

line 42why, one step back
42 assert.equal(app.get('trust proxy fn'), fn)

docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574

lines 43–49why, one step back
43 })
44 })45 })4647 describe('.get()', function(){48 it('should return undefined when unset', function(){49 var app = express();

Merge tag '3.20.0'Douglas Christopher Wilsonbefore adoption531f024

line 50why, one step back
50 assert.strictEqual(app.get('foo'), undefined);

docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574

lines 51–55why, one step back
51 })
52 53 it('should otherwise return the value', function(){54 var app = express();55 app.set('foo', 'bar');

Merge tag '3.20.0'Douglas Christopher Wilsonbefore adoption531f024

line 56why, one step back
56 assert.equal(app.get('foo'), 'bar');

docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574

lines 57–60why, one step back
57 })
5859 describe('when mounted', function(){60 it('should default to the parent app', function(){

Merge tag '3.20.0'Douglas Christopher Wilsonbefore adoption531f024

lines 61–62why, one step back
61 var app = express();
62 var blog = express();

docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574

lines 63–65why, one step back
63
64 app.set('title', 'Express');65 app.use(blog);

Merge tag '3.20.0'Douglas Christopher Wilsonbefore adoption531f024

line 66why, one step back
66 assert.equal(blog.get('title'), 'Express');

docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574

line 67why, one step back
67 })

Merge tag '3.20.0'Douglas Christopher Wilsonbefore adoption531f024

line 68why, one step back
68

docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574

line 69why, one step back
69 it('should given precedence to the child', function(){

Merge tag '3.20.0'Douglas Christopher Wilsonbefore adoption531f024

lines 70–71why, one step back
70 var app = express();
71 var blog = express();

docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574

lines 72–76why, one step back
72
73 app.use(blog);74 app.set('title', 'Express');75 blog.set('title', 'Some Blog');76

Merge tag '3.20.0'Douglas Christopher Wilsonbefore adoption531f024

line 77why, one step back
77 assert.equal(blog.get('title'), 'Some Blog');

docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574

line 78why, one step back
78 })

Merge tag '3.20.0'Douglas Christopher Wilsonbefore adoption531f024

lines 79–117why, one step back
79
80 it('should inherit "trust proxy" setting', function () {81 var app = express();82 var blog = express();8384 function fn() { return false }8586 app.set('trust proxy', fn);87 assert.equal(app.get('trust proxy'), fn);88 assert.equal(app.get('trust proxy fn'), fn);8990 app.use(blog);9192 assert.equal(blog.get('trust proxy'), fn);93 assert.equal(blog.get('trust proxy fn'), fn);94 })9596 it('should prefer child "trust proxy" setting', function () {97 var app = express();98 var blog = express();99100 function fn1() { return false }101 function fn2() { return true }102103 app.set('trust proxy', fn1);104 assert.equal(app.get('trust proxy'), fn1);105 assert.equal(app.get('trust proxy fn'), fn1);106107 blog.set('trust proxy', fn2);108 assert.equal(blog.get('trust proxy'), fn2);109 assert.equal(blog.get('trust proxy fn'), fn2);110111 app.use(blog);112113 assert.equal(app.get('trust proxy'), fn1);114 assert.equal(app.get('trust proxy fn'), fn1);115 assert.equal(blog.get('trust proxy'), fn2);116 assert.equal(blog.get('trust proxy fn'), fn2);117 })

docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574

lines 118–123why, one step back
118 })
119 })120121 describe('.enable()', function(){122 it('should set the value to true', function(){123 var app = express();

Merge tag '3.20.0'Douglas Christopher Wilsonbefore adoption531f024

lines 124–125why, one step back
124 assert.equal(app.enable('tobi'), app);
125 assert.strictEqual(app.get('tobi'), true);

docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574

lines 126–131why, one step back
126 })
127 })128 129 describe('.disable()', function(){130 it('should set the value to false', function(){131 var app = express();

Merge tag '3.20.0'Douglas Christopher Wilsonbefore adoption531f024

lines 132–133why, one step back
132 assert.equal(app.disable('tobi'), app);
133 assert.strictEqual(app.get('tobi'), false);

docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574

lines 134–139why, one step back
134 })
135 })136 137 describe('.enabled()', function(){138 it('should default to false', function(){139 var app = express();

Merge tag '3.20.0'Douglas Christopher Wilsonbefore adoption531f024

line 140why, one step back
140 assert.strictEqual(app.enabled('foo'), false);

docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574

lines 141–145why, one step back
141 })
142 143 it('should return true when set', function(){144 var app = express();145 app.set('foo', 'bar');

Merge tag '3.20.0'Douglas Christopher Wilsonbefore adoption531f024

line 146why, one step back
146 assert.strictEqual(app.enabled('foo'), true);

docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574

lines 147–152why, one step back
147 })
148 })149 150 describe('.disabled()', function(){151 it('should default to true', function(){152 var app = express();

Merge tag '3.20.0'Douglas Christopher Wilsonbefore adoption531f024

line 153why, one step back
153 assert.strictEqual(app.disabled('foo'), true);

docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574

lines 154–158why, one step back
154 })
155 156 it('should return false when set', function(){157 var app = express();158 app.set('foo', 'bar');

Merge tag '3.20.0'Douglas Christopher Wilsonbefore adoption531f024

line 159why, one step back
159 assert.strictEqual(app.disabled('foo'), false);

docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574

lines 160–162why, one step back
160 })
161 })162})