diff --git a/test/diff2html-tests.js b/test/diff2html-tests.js
new file mode 100644
index 0000000..5e33112
--- /dev/null
+++ b/test/diff2html-tests.js
@@ -0,0 +1,26 @@
+var assert = require('assert');
+
+var Diff2Html = require('../src/diff2html.js').Diff2Html;
+
+describe('Diff2Html', function() {
+ describe('getJsonFromDiff', function() {
+ it('should parse simple diff to json', function() {
+ var diff =
+ 'diff --git a/sample b/sample\n'+
+ 'index 0000001..0ddf2ba\n'+
+ '--- a/sample\n'+
+ '+++ b/sample\n'+
+ '@@ -1 +1 @@\n'+
+ '-test\n'+
+ '+test1\n';
+ var result = Diff2Html.getJsonFromDiff(diff);
+ var file1 = result[0];
+ assert.equal(1, result.length);
+ assert.equal(1, file1.addedLines);
+ assert.equal(1, file1.deletedLines);
+ assert.equal('sample', file1.oldName);
+ assert.equal('sample', file1.newName);
+ assert.equal(1, file1.blocks.length);
+ });
+ });
+});
diff --git a/test/utils-tests.js b/test/utils-tests.js
new file mode 100644
index 0000000..69f9ab5
--- /dev/null
+++ b/test/utils-tests.js
@@ -0,0 +1,25 @@
+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('\tlink text');
+ var expected = '<a href="#"> link text</a>';
+ assert.equal(expected, result);
+ });
+ });
+});