25 lines
824 B
JavaScript
25 lines
824 B
JavaScript
var assert = require('assert');
|
|
|
|
var Utils = require('../src/utils.js').Utils;
|
|
|
|
describe('Utils', function() {
|
|
describe('escape', function() {
|
|
it('should escape & with &', function() {
|
|
var result = Utils.escape('&');
|
|
assert.equal('&', result);
|
|
});
|
|
it('should escape < with <', function() {
|
|
var result = Utils.escape('<');
|
|
assert.equal('<', result);
|
|
});
|
|
it('should escape > with >', function() {
|
|
var result = Utils.escape('>');
|
|
assert.equal('>', result);
|
|
});
|
|
it('should escape a string with multiple problematic characters', function() {
|
|
var result = Utils.escape('<a href="#">\tlink text</a>');
|
|
var expected = '<a href="#"> link text</a>';
|
|
assert.equal(expected, result);
|
|
});
|
|
});
|
|
});
|