Skip to content
Myr

utils.js

This file

Path

test/utils.js

73 lines · 1.8 KiB · JavaScript

Last changed by

Use etag to generate ETag headersDouglas Christopher Wilsonbefore adoption51d33ed

History of this file

Take it

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

tests: flow control with afterDouglas Christopher Wilsonbefore adoption23ff74b

lines 1–4why, one step back
1
2var utils = require('../lib/utils')3 , assert = require('assert');4

Merge tag '3.9.0'Douglas Christopher Wilsonbefore adoptiondb4448d

line 5why, one step back
5describe('utils.etag(body, encoding)', function(){

tests: flow control with afterDouglas Christopher Wilsonbefore adoption23ff74b

line 6why, one step back
6 it('should support strings', function(){

Merge tag '3.9.0'Douglas Christopher Wilsonbefore adoptiondb4448d

lines 7–8why, one step back
7 utils.etag('express!')
8 .should.eql('"zZdv4imtWD49AHEviejT6A=="')

tests: flow control with afterDouglas Christopher Wilsonbefore adoption23ff74b

lines 9–11why, one step back
9 })
1011 it('should support utf8 strings', function(){

Merge tag '3.9.0'Douglas Christopher Wilsonbefore adoptiondb4448d

lines 12–13why, one step back
12 utils.etag('express❤', 'utf8')
13 .should.eql('"fsFba4IxwQS6h6Umb+FNxw=="')

tests: flow control with afterDouglas Christopher Wilsonbefore adoption23ff74b

lines 14–16why, one step back
14 })
1516 it('should support buffer', function(){

Merge tag '3.9.0'Douglas Christopher Wilsonbefore adoptiondb4448d

lines 17–19why, one step back
17 var buf = new Buffer('express!')
18 utils.etag(buf)19 .should.eql('"zZdv4imtWD49AHEviejT6A=="');

tests: flow control with afterDouglas Christopher Wilsonbefore adoption23ff74b

lines 20–21why, one step back
20 })
21

Merge tag '3.9.0'Douglas Christopher Wilsonbefore adoptiondb4448d

lines 22–25why, one step back
22 it('should support empty string', function(){
23 utils.etag('')24 .should.eql('"1B2M2Y8AsgTpgAmY7PhCfg=="');25 })

tests: flow control with afterDouglas Christopher Wilsonbefore adoption23ff74b

lines 26–27why, one step back
26})
27

Merge tag '3.9.0'Douglas Christopher Wilsonbefore adoptiondb4448d

lines 28–30why, one step back
28describe('utils.wetag(body, encoding)', function(){
29 it('should support strings', function(){30 utils.wetag('express!')

Use etag to generate ETag headersDouglas Christopher Wilsonbefore adoption51d33ed

line 31why, one step back
31 .should.eql('W/"8-b8aabac7"')

Merge tag '3.9.0'Douglas Christopher Wilsonbefore adoptiondb4448d

lines 32–35why, one step back
32 })
3334 it('should support utf8 strings', function(){35 utils.wetag('express❤', 'utf8')

Use etag to generate ETag headersDouglas Christopher Wilsonbefore adoption51d33ed

line 36why, one step back
36 .should.eql('W/"a-686b0af1"')

Merge tag '3.9.0'Douglas Christopher Wilsonbefore adoptiondb4448d

lines 37–41why, one step back
37 })
3839 it('should support buffer', function(){40 var buf = new Buffer('express!')41 utils.wetag(buf)

Use etag to generate ETag headersDouglas Christopher Wilsonbefore adoption51d33ed

line 42why, one step back
42 .should.eql('W/"8-b8aabac7"');

Merge tag '3.9.0'Douglas Christopher Wilsonbefore adoptiondb4448d

lines 43–50why, one step back
43 })
4445 it('should support empty string', function(){46 utils.wetag('')47 .should.eql('W/"0-0"');48 })49})50

tests: flow control with afterDouglas Christopher Wilsonbefore adoption23ff74b

lines 51–56why, one step back
51describe('utils.isAbsolute()', function(){
52 it('should support windows', function(){53 assert(utils.isAbsolute('c:\\'));54 assert(!utils.isAbsolute(':\\'));55 })56

Merge tag '3.9.0'Douglas Christopher Wilsonbefore adoptiondb4448d

lines 57–61why, one step back
57 it('should support windows unc', function(){
58 assert(utils.isAbsolute('\\\\foo\\bar'))59 })6061 it('should support unices', function(){

tests: flow control with afterDouglas Christopher Wilsonbefore adoption23ff74b

lines 62–73why, one step back
62 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})