Skip to content
Myr

utils.js

This file

Path

test/utils.js

87 lines · 2.4 KiB · JavaScript

Last changed by

Remove utils.flattenDouglas Christopher Wilsonbefore adoption6c75119

History of this file

Take it

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

deps: update example dependenciesDouglas Christopher Wilsonbefore adoptionca306ea

line 1why, one step back
1

Merge tag '4.12.0'Douglas Christopher Wilsonbefore adoptionf6ec710

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

deps: update example dependenciesDouglas Christopher Wilsonbefore adoptionca306ea

lines 4–7why, one step back
4
5describe('utils.etag(body, encoding)', function(){6 it('should support strings', function(){7 utils.etag('express!')

Merge tag '4.13.1'Douglas Christopher Wilsonbefore adoptionb309b87

line 8why, one step back
8 .should.eql('"8-zZdv4imtWD49AHEviejT6A"')

deps: update example dependenciesDouglas Christopher Wilsonbefore adoptionca306ea

lines 9–12why, one step back
9 })
1011 it('should support utf8 strings', function(){12 utils.etag('express❤', 'utf8')

Merge tag '4.13.1'Douglas Christopher Wilsonbefore adoptionb309b87

line 13why, one step back
13 .should.eql('"a-fsFba4IxwQS6h6Umb+FNxw"')

deps: update example dependenciesDouglas Christopher Wilsonbefore adoptionca306ea

lines 14–18why, one step back
14 })
1516 it('should support buffer', function(){17 var buf = new Buffer('express!')18 utils.etag(buf)

Merge tag '4.13.1'Douglas Christopher Wilsonbefore adoptionb309b87

line 19why, one step back
19 .should.eql('"8-zZdv4imtWD49AHEviejT6A"');

deps: update example dependenciesDouglas Christopher Wilsonbefore adoptionca306ea

lines 20–23why, one step back
20 })
2122 it('should support empty string', function(){23 utils.etag('')

Merge tag '4.13.1'Douglas Christopher Wilsonbefore adoptionb309b87

line 24why, one step back
24 .should.eql('"0-1B2M2Y8AsgTpgAmY7PhCfg"');

deps: update example dependenciesDouglas Christopher Wilsonbefore adoptionca306ea

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

Merge tag '4.12.0'Douglas Christopher Wilsonbefore adoptionf6ec710

lines 27–48why, one step back
27
28describe('utils.setCharset(type, charset)', function () {29 it('should do anything without type', function () {30 assert.strictEqual(utils.setCharset(), undefined);31 });3233 it('should return type if not given charset', function () {34 assert.strictEqual(utils.setCharset('text/html'), 'text/html');35 });3637 it('should keep charset if not given charset', function () {38 assert.strictEqual(utils.setCharset('text/html; charset=utf-8'), 'text/html; charset=utf-8');39 });4041 it('should set charset', function () {42 assert.strictEqual(utils.setCharset('text/html', 'utf-8'), 'text/html; charset=utf-8');43 });4445 it('should override charset', function () {46 assert.strictEqual(utils.setCharset('text/html; charset=iso-8859-1', 'utf-8'), 'text/html; charset=utf-8');47 });48});

deps: update example dependenciesDouglas Christopher Wilsonbefore adoptionca306ea

lines 49–52why, one step back
49
50describe('utils.wetag(body, encoding)', function(){51 it('should support strings', function(){52 utils.wetag('express!')

Merge tag '4.13.1'Douglas Christopher Wilsonbefore adoptionb309b87

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

deps: update example dependenciesDouglas Christopher Wilsonbefore adoptionca306ea

lines 54–57why, one step back
54 })
5556 it('should support utf8 strings', function(){57 utils.wetag('express❤', 'utf8')

Merge tag '4.13.1'Douglas Christopher Wilsonbefore adoptionb309b87

line 58why, one step back
58 .should.eql('W/"a-fsFba4IxwQS6h6Umb+FNxw"')

deps: update example dependenciesDouglas Christopher Wilsonbefore adoptionca306ea

lines 59–63why, one step back
59 })
6061 it('should support buffer', function(){62 var buf = new Buffer('express!')63 utils.wetag(buf)

Merge tag '4.13.1'Douglas Christopher Wilsonbefore adoptionb309b87

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

deps: update example dependenciesDouglas Christopher Wilsonbefore adoptionca306ea

lines 65–68why, one step back
65 })
6667 it('should support empty string', function(){68 utils.wetag('')

Merge tag '4.13.1'Douglas Christopher Wilsonbefore adoptionb309b87

line 69why, one step back
69 .should.eql('W/"0-1B2M2Y8AsgTpgAmY7PhCfg"');

deps: update example dependenciesDouglas Christopher Wilsonbefore adoptionca306ea

lines 70–87why, one step back
70 })
71})7273describe('utils.isAbsolute()', function(){74 it('should support windows', function(){75 assert(utils.isAbsolute('c:\\'));76 assert(!utils.isAbsolute(':\\'));77 })7879 it('should support windows unc', function(){80 assert(utils.isAbsolute('\\\\foo\\bar'))81 })8283 it('should support unices', function(){84 assert(utils.isAbsolute('/foo/bar'));85 assert(!utils.isAbsolute('foo/bar'));86 })87})