Skip to content
Myr

req.range.js

This file

Path

test/req.range.js

38 lines · 1016 bytes · JavaScript

Last changed by

Not known.

History of this file

Take it

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

tests: improve examples/auth testsDouglas Christopher Wilsonbefore adoption1f938c5

line 1why, one step back
1

tests: add more various testsDouglas Christopher Wilsonbefore adoption83b8b7a

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

tests: improve examples/auth testsDouglas Christopher Wilsonbefore adoption1f938c5

lines 4–29why, one step back
4
5function req(ret) {6 return {7 get: function(){ return ret }8 , __proto__: express.request9 };10}1112describe('req', function(){13 describe('.range(size)', function(){14 it('should return parsed ranges', function(){15 var ret = [{ start: 0, end: 50 }, { start: 60, end: 100 }];16 ret.type = 'bytes';17 req('bytes=0-50,60-100').range(120).should.eql(ret);18 })1920 it('should cap to the given size', function(){21 var ret = [{ start: 0, end: 74 }];22 ret.type = 'bytes';23 req('bytes=0-100').range(75).should.eql(ret);24 })2526 it('should have a .type', function(){27 var ret = [{ start: 0, end: Infinity }];28 ret.type = 'users';29 req('users=0-').range(Infinity).should.eql(ret);

tests: add more various testsDouglas Christopher Wilsonbefore adoption83b8b7a

lines 30–35why, one step back
30 })
3132 it('should return undefined if no range', function(){33 var ret = [{ start: 0, end: 50 }, { start: 60, end: 100 }];34 ret.type = 'bytes';35 assert(req('').range(120) === undefined);

tests: improve examples/auth testsDouglas Christopher Wilsonbefore adoption1f938c5

lines 36–38why, one step back
36 })
37 })38})