diff2html/test/utils-tests.js
2015-12-23 14:14:29 +01:00

25 lines
809 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 &lt;', function() {
var result = Utils.escape('<');
assert.equal('&lt;', result);
});
it('should escape > with &gt;', function() {
var result = Utils.escape('>');
assert.equal('&gt;', result);
});
it('should escape a string with multiple problematic characters', function() {
var result = Utils.escape('<a href="#">\tlink text</a>');
var expected = '&lt;a href="#"&gt; link text&lt;/a&gt;';
assert.equal(expected, result);
});
});
});