utils.js
This file
Path
test/utils.js
73 lines · 1.8 KiB · JavaScript
Last changed by
Merge tag '3.12.0'Douglas Christopher Wilsonbefore adoption3ffceff
History of this fileTake it
The walk stopped after 200 commits: lines older than 2e68ddb point at it.
expose connect.middleware using Object.getOwnPropertyDescriptor()Jonathan Ongbefore adoption2e68ddb
lines 1–4why, one step back12var utils = require('../lib/utils')3 , assert = require('assert');4Merge tag '3.9.0'Douglas Christopher Wilsonbefore adoptiondb4448d
line 5why, one step back5describe('utils.etag(body, encoding)', function(){expose connect.middleware using Object.getOwnPropertyDescriptor()Jonathan Ongbefore adoption2e68ddb
line 6why, one step back6 it('should support strings', function(){Merge tag '3.9.0'Douglas Christopher Wilsonbefore adoptiondb4448d
lines 7–8why, one step back7 utils.etag('express!')8 .should.eql('"zZdv4imtWD49AHEviejT6A=="')expose connect.middleware using Object.getOwnPropertyDescriptor()Jonathan Ongbefore adoption2e68ddb
lines 9–11why, one step back9 })1011 it('should support utf8 strings', function(){Merge tag '3.9.0'Douglas Christopher Wilsonbefore adoptiondb4448d
lines 12–13why, one step back12 utils.etag('express❤', 'utf8')13 .should.eql('"fsFba4IxwQS6h6Umb+FNxw=="')expose connect.middleware using Object.getOwnPropertyDescriptor()Jonathan Ongbefore adoption2e68ddb
lines 14–16why, one step back14 })1516 it('should support buffer', function(){Merge tag '3.9.0'Douglas Christopher Wilsonbefore adoptiondb4448d
lines 17–19why, one step back17 var buf = new Buffer('express!')18 utils.etag(buf)19 .should.eql('"zZdv4imtWD49AHEviejT6A=="');expose connect.middleware using Object.getOwnPropertyDescriptor()Jonathan Ongbefore adoption2e68ddb
lines 20–21why, one step back20 })21Merge tag '3.9.0'Douglas Christopher Wilsonbefore adoptiondb4448d
lines 22–25why, one step back22 it('should support empty string', function(){23 utils.etag('')24 .should.eql('"1B2M2Y8AsgTpgAmY7PhCfg=="');25 })expose connect.middleware using Object.getOwnPropertyDescriptor()Jonathan Ongbefore adoption2e68ddb
lines 26–27why, one step back26})27Merge tag '3.9.0'Douglas Christopher Wilsonbefore adoptiondb4448d
lines 28–50why, one step back28describe('utils.wetag(body, encoding)', function(){29 it('should support strings', function(){30 utils.wetag('express!')31 .should.eql('W/"8-3098196679"')32 })3334 it('should support utf8 strings', function(){35 utils.wetag('express❤', 'utf8')36 .should.eql('W/"a-1751845617"')37 })3839 it('should support buffer', function(){40 var buf = new Buffer('express!')41 utils.wetag(buf)42 .should.eql('W/"8-3098196679"');43 })4445 it('should support empty string', function(){46 utils.wetag('')47 .should.eql('W/"0-0"');48 })49})50expose connect.middleware using Object.getOwnPropertyDescriptor()Jonathan Ongbefore adoption2e68ddb
lines 51–56why, one step back51describe('utils.isAbsolute()', function(){52 it('should support windows', function(){53 assert(utils.isAbsolute('c:\\'));54 assert(!utils.isAbsolute(':\\'));55 })56Merge tag '3.9.0'Douglas Christopher Wilsonbefore adoptiondb4448d
lines 57–61why, one step back57 it('should support windows unc', function(){58 assert(utils.isAbsolute('\\\\foo\\bar'))59 })6061 it('should support unices', function(){expose connect.middleware using Object.getOwnPropertyDescriptor()Jonathan Ongbefore adoption2e68ddb
lines 62–73why, one step back62 assert(utils.isAbsolute('/foo/bar'));63 assert(!utils.isAbsolute('foo/bar'));64 })65})6667describe('utils.flatten(arr)', function(){68 it('should flatten an array', function(){69 var arr = ['one', ['two', ['three', 'four'], 'five']];70 utils.flatten(arr)71 .should.eql(['one', 'two', 'three', 'four', 'five']);72 })73})