Skip to content
Myr

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 file

Take 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 back
1'use strict'

deps: finalhandler@1.1.1Douglas Christopher Wilsonbefore adoption76bf96e

lines 2–7why, one step back
2
3var 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 back
8 it('should return language if accepted', function (done) {

deps: finalhandler@1.1.1Douglas Christopher Wilsonbefore adoption76bf96e

lines 9–10why, one step back
9 var app = express();
10

tests: fix wording of req.accepts* test casesDouglas Christopher Wilsonbefore adoption215f484

lines 11–12why, one step back
11 app.get('/', function (req, res) {
12 res.send({

tests: fix req.acceptsLanguage testsDouglas Christopher Wilsonbefore adoptiond8ed591

lines 13–14why, one step back
13 '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 back
15 })
16 })

deps: finalhandler@1.1.1Douglas Christopher Wilsonbefore adoption76bf96e

lines 17–18why, one step back
17
18 request(app)

tests: fix wording of req.accepts* test casesDouglas Christopher Wilsonbefore adoption215f484

lines 19–21why, one step back
19 .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 back
22 })
2324 it('should be false if language not accepted', function(done){25 var app = express();26

tests: fix wording of req.accepts* test casesDouglas Christopher Wilsonbefore adoption215f484

lines 27–28why, one step back
27 app.get('/', function (req, res) {
28 res.send({

tests: fix req.acceptsLanguage testsDouglas Christopher Wilsonbefore adoptiond8ed591

line 29why, one step back
29 es: req.acceptsLanguage('es')

tests: fix wording of req.accepts* test casesDouglas Christopher Wilsonbefore adoption215f484

lines 30–31why, one step back
30 })
31 })

deps: finalhandler@1.1.1Douglas Christopher Wilsonbefore adoption76bf96e

lines 32–33why, one step back
32
33 request(app)

tests: fix wording of req.accepts* test casesDouglas Christopher Wilsonbefore adoption215f484

lines 34–36why, one step back
34 .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 back
37 })
3839 describe('when Accept-Language is not present', function(){

tests: fix wording of req.accepts* test casesDouglas Christopher Wilsonbefore adoption215f484

line 40why, one step back
40 it('should always return language', function (done) {

deps: finalhandler@1.1.1Douglas Christopher Wilsonbefore adoption76bf96e

lines 41–42why, one step back
41 var app = express();
42

tests: fix wording of req.accepts* test casesDouglas Christopher Wilsonbefore adoption215f484

lines 43–44why, one step back
43 app.get('/', function (req, res) {
44 res.send({

tests: fix req.acceptsLanguage testsDouglas Christopher Wilsonbefore adoptiond8ed591

lines 45–47why, one step back
45 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 back
48 })
49 })

deps: finalhandler@1.1.1Douglas Christopher Wilsonbefore adoption76bf96e

lines 50–51why, one step back
50
51 request(app)

tests: fix wording of req.accepts* test casesDouglas Christopher Wilsonbefore adoption215f484

lines 52–53why, one step back
52 .get('/')
53 .expect(200, { en: 'en', es: 'es', jp: 'jp' }, done)

deps: finalhandler@1.1.1Douglas Christopher Wilsonbefore adoption76bf96e

lines 54–57why, one step back
54 })
55 })56 })57})