Skip to content
Myr

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 file

Take it

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

Merge pull request #1892 from matheusazzi/patch-1Jonathan Ongbefore adoption185b526

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(){

Merge pull request #1892 from matheusazzi/patch-1Jonathan Ongbefore adoption185b526

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=="')

Merge pull request #1892 from matheusazzi/patch-1Jonathan Ongbefore adoption185b526

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=="')

Merge pull request #1892 from matheusazzi/patch-1Jonathan Ongbefore adoption185b526

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=="');

Merge pull request #1892 from matheusazzi/patch-1Jonathan Ongbefore adoption185b526

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 })

Merge pull request #1892 from matheusazzi/patch-1Jonathan Ongbefore adoption185b526

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

Merge tag '3.9.0'Douglas Christopher Wilsonbefore adoptiondb4448d

lines 28–50why, one step back
28describe('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})50

Merge pull request #1892 from matheusazzi/patch-1Jonathan Ongbefore adoption185b526

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(){

Merge pull request #1892 from matheusazzi/patch-1Jonathan Ongbefore adoption185b526

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})