Skip to content
Myr

req.range.js

This file

Path

test/req.range.js

103 lines · 2.3 KiB · JavaScript

Last changed by

lint: remove all unused varaiblesDouglas Christopher Wilsonbefore adoptione006622

History of this file

Take it

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

examples: comment the usage of process.nextTickMuhammad Saqibbefore adoptiondd2b897

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

tests: update req.range tests to run through expressDouglas Christopher Wilsonbefore adoption3e3d357

line 3why, one step back
3var request = require('supertest')

examples: comment the usage of process.nextTickMuhammad Saqibbefore adoptiondd2b897

lines 4–6why, one step back
4
5describe('req', function(){6 describe('.range(size)', function(){

tests: update req.range tests to run through expressDouglas Christopher Wilsonbefore adoption3e3d357

lines 7–17why, one step back
7 it('should return parsed ranges', function (done) {
8 var app = express()910 app.use(function (req, res) {11 res.json(req.range(120))12 })1314 request(app)15 .get('/')16 .set('Range', 'bytes=0-50,51-100')17 .expect(200, '[{"start":0,"end":50},{"start":51,"end":100}]', done)

examples: comment the usage of process.nextTickMuhammad Saqibbefore adoptiondd2b897

lines 18–19why, one step back
18 })
19

tests: update req.range tests to run through expressDouglas Christopher Wilsonbefore adoption3e3d357

lines 20–30why, one step back
20 it('should cap to the given size', function (done) {
21 var app = express()2223 app.use(function (req, res) {24 res.json(req.range(75))25 })2627 request(app)28 .get('/')29 .set('Range', 'bytes=0-100')30 .expect(200, '[{"start":0,"end":74}]', done)

examples: comment the usage of process.nextTickMuhammad Saqibbefore adoptiondd2b897

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

tests: update req.range tests to run through expressDouglas Christopher Wilsonbefore adoption3e3d357

lines 33–43why, one step back
33 it('should cap to the given size when open-ended', function (done) {
34 var app = express()3536 app.use(function (req, res) {37 res.json(req.range(75))38 })3940 request(app)41 .get('/')42 .set('Range', 'bytes=0-')43 .expect(200, '[{"start":0,"end":74}]', done)

examples: comment the usage of process.nextTickMuhammad Saqibbefore adoptiondd2b897

lines 44–45why, one step back
44 })
45

tests: update req.range tests to run through expressDouglas Christopher Wilsonbefore adoption3e3d357

lines 46–56why, one step back
46 it('should have a .type', function (done) {
47 var app = express()4849 app.use(function (req, res) {50 res.json(req.range(120).type)51 })5253 request(app)54 .get('/')55 .set('Range', 'bytes=0-100')56 .expect(200, '"bytes"', done)

Add "options" argument to req.rangeDouglas Christopher Wilsonbefore adoption5d642af

line 57why, one step back
57 })

tests: update req.range tests to run through expressDouglas Christopher Wilsonbefore adoption3e3d357

lines 58–82why, one step back
58
59 it('should accept any type', function (done) {60 var app = express()6162 app.use(function (req, res) {63 res.json(req.range(120).type)64 })6566 request(app)67 .get('/')68 .set('Range', 'users=0-2')69 .expect(200, '"users"', done)70 })7172 it('should return undefined if no range', function (done) {73 var app = express()7475 app.use(function (req, res) {76 res.send(String(req.range(120)))77 })7879 request(app)80 .get('/')81 .expect(200, 'undefined', done)82 })

Add "options" argument to req.rangeDouglas Christopher Wilsonbefore adoption5d642af

lines 83–86why, one step back
83 })
8485 describe('.range(size, options)', function(){86 describe('with "combine: true" option', function(){

tests: update req.range tests to run through expressDouglas Christopher Wilsonbefore adoption3e3d357

lines 87–99why, one step back
87 it('should return combined ranges', function (done) {
88 var app = express()8990 app.use(function (req, res) {91 res.json(req.range(120, {92 combine: true93 }))94 })9596 request(app)97 .get('/')98 .set('Range', 'bytes=0-50,51-100')99 .expect(200, '[{"start":0,"end":100}]', done)

Add "options" argument to req.rangeDouglas Christopher Wilsonbefore adoption5d642af

line 100why, one step back
100 })

examples: comment the usage of process.nextTickMuhammad Saqibbefore adoptiondd2b897

lines 101–103why, one step back
101 })
102 })103})