req.acceptsLanguage.js
This file
Path
test/req.acceptsLanguage.js
57 lines · 1.4 KiB · JavaScript
Last changed by
tests: fix req.acceptsLanguage testsDouglas Christopher Wilsonbefore adoptiond8ed591
History of this fileTake it
The walk stopped after 200 commits: lines older than 76bf96e point at it.
tests: use strict modeDouglas Christopher Wilsonbefore adoptiona659137
line 1why, one step back1'use strict'deps: finalhandler@1.1.1Douglas Christopher Wilsonbefore adoption76bf96e
lines 2–7why, one step back23var express = require('../')4 , request = require('supertest');56describe('req', function(){7 describe('.acceptsLanguage', function(){tests: fix wording of req.accepts* test casesDouglas Christopher Wilsonbefore adoption215f484
line 8why, one step back8 it('should return language if accepted', function (done) {deps: finalhandler@1.1.1Douglas Christopher Wilsonbefore adoption76bf96e
lines 9–10why, one step back9 var app = express();10tests: fix wording of req.accepts* test casesDouglas Christopher Wilsonbefore adoption215f484
lines 11–12why, one step back11 app.get('/', function (req, res) {12 res.send({tests: fix req.acceptsLanguage testsDouglas Christopher Wilsonbefore adoptiond8ed591
lines 13–14why, one step back13 'en-us': req.acceptsLanguage('en-us'),14 en: req.acceptsLanguage('en')tests: fix wording of req.accepts* test casesDouglas Christopher Wilsonbefore adoption215f484
lines 15–16why, one step back15 })16 })deps: finalhandler@1.1.1Douglas Christopher Wilsonbefore adoption76bf96e
lines 17–18why, one step back1718 request(app)tests: fix wording of req.accepts* test casesDouglas Christopher Wilsonbefore adoption215f484
lines 19–21why, one step back19 .get('/')20 .set('Accept-Language', 'en;q=.5, en-us')21 .expect(200, { 'en-us': 'en-us', en: 'en' }, done)deps: finalhandler@1.1.1Douglas Christopher Wilsonbefore adoption76bf96e
lines 22–26why, one step back22 })2324 it('should be false if language not accepted', function(done){25 var app = express();26tests: fix wording of req.accepts* test casesDouglas Christopher Wilsonbefore adoption215f484
lines 27–28why, one step back27 app.get('/', function (req, res) {28 res.send({tests: fix req.acceptsLanguage testsDouglas Christopher Wilsonbefore adoptiond8ed591
line 29why, one step back29 es: req.acceptsLanguage('es')tests: fix wording of req.accepts* test casesDouglas Christopher Wilsonbefore adoption215f484
lines 30–31why, one step back30 })31 })deps: finalhandler@1.1.1Douglas Christopher Wilsonbefore adoption76bf96e
lines 32–33why, one step back3233 request(app)tests: fix wording of req.accepts* test casesDouglas Christopher Wilsonbefore adoption215f484
lines 34–36why, one step back34 .get('/')35 .set('Accept-Language', 'en;q=.5, en-us')36 .expect(200, { es: false }, done)deps: finalhandler@1.1.1Douglas Christopher Wilsonbefore adoption76bf96e
lines 37–39why, one step back37 })3839 describe('when Accept-Language is not present', function(){tests: fix wording of req.accepts* test casesDouglas Christopher Wilsonbefore adoption215f484
line 40why, one step back40 it('should always return language', function (done) {deps: finalhandler@1.1.1Douglas Christopher Wilsonbefore adoption76bf96e
lines 41–42why, one step back41 var app = express();42tests: fix wording of req.accepts* test casesDouglas Christopher Wilsonbefore adoption215f484
lines 43–44why, one step back43 app.get('/', function (req, res) {44 res.send({tests: fix req.acceptsLanguage testsDouglas Christopher Wilsonbefore adoptiond8ed591
lines 45–47why, one step back45 en: req.acceptsLanguage('en'),46 es: req.acceptsLanguage('es'),47 jp: req.acceptsLanguage('jp')tests: fix wording of req.accepts* test casesDouglas Christopher Wilsonbefore adoption215f484
lines 48–49why, one step back48 })49 })deps: finalhandler@1.1.1Douglas Christopher Wilsonbefore adoption76bf96e
lines 50–51why, one step back5051 request(app)tests: fix wording of req.accepts* test casesDouglas Christopher Wilsonbefore adoption215f484
lines 52–53why, one step back52 .get('/')53 .expect(200, { en: 'en', es: 'es', jp: 'jp' }, done)deps: finalhandler@1.1.1Douglas Christopher Wilsonbefore adoption76bf96e
lines 54–57why, one step back54 })55 })56 })57})