utils.js
This file
Path
test/utils.js
31 lines · 807 bytes · JavaScript
Last changed by
Added utils.escape(html) testTj Holowaychukbefore adoptionce2ec94
History of this fileTake it
utils.isAbsolute() testsTj Holowaychukbefore adoption5221ecc
lines 1–16why, one step back123var utils = require('../lib/utils')4 , assert = require('assert');56describe('utils.isAbsolute()', function(){7 it('should support windows', function(){8 assert(utils.isAbsolute('c:\\'));9 assert(!utils.isAbsolute(':\\'));10 })11 12 it('should unices', function(){13 assert(utils.isAbsolute('/foo/bar'));14 assert(!utils.isAbsolute('foo/bar'));15 })16})Added utils.flatten(arr) testsTj Holowaychukbefore adoptiond56e5d6
lines 17–20why, one step back1718describe('utils.flatten(arr)', function(){19 it('should flatten an array', function(){20 var arr = ['one', ['two', ['three', 'four'], 'five']];Added utils.escape(html) testTj Holowaychukbefore adoptionce2ec94
line 21why, one step back21 utils.flatten(arr)Added utils.flatten(arr) testsTj Holowaychukbefore adoptiond56e5d6
line 22why, one step back22 .should.eql(['one', 'two', 'three', 'four', 'five']);Added utils.escape(html) testTj Holowaychukbefore adoptionce2ec94
lines 23–29why, one step back23 })24})2526describe('utils.escape(html)', function(){27 it('should escape html entities', function(){28 utils.escape('<script>foo & "bar"')29 .should.equal('<script>foo & "bar"')Added utils.flatten(arr) testsTj Holowaychukbefore adoptiond56e5d6
lines 30–31why, one step back30 })31})