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
12345678910111213141516171819202122232425262728293031
var utils = require('../lib/utils') , assert = require('assert');
describe('utils.isAbsolute()', function(){ it('should support windows', function(){ assert(utils.isAbsolute('c:\\')); assert(!utils.isAbsolute(':\\')); }) it('should unices', function(){ assert(utils.isAbsolute('/foo/bar')); assert(!utils.isAbsolute('foo/bar')); })})
describe('utils.flatten(arr)', function(){ it('should flatten an array', function(){ var arr = ['one', ['two', ['three', 'four'], 'five']]; utils.flatten(arr) .should.eql(['one', 'two', 'three', 'four', 'five']); })})
describe('utils.escape(html)', function(){ it('should escape html entities', function(){ utils.escape('<script>foo & "bar"') .should.equal('<script>foo & "bar"') })})