node tests: Add coverage for unexpected exceptions in handleTex.

This commit is contained in:
Yago González 2017-06-14 11:19:00 +02:00 committed by showell
parent 6c0dfa7f8f
commit 31d81e2c9b
1 changed files with 14 additions and 0 deletions

View File

@ -30,6 +30,8 @@ set_global('page_params', {
],
});
set_global('blueslip', {});
add_dependencies({
marked: 'third/marked/lib/marked.js',
emoji_codes: 'generated/emoji/emoji_codes.js',
@ -327,3 +329,15 @@ var bugdown_data = JSON.parse(fs.readFileSync(path.join(__dirname, '../../zerver
var expected_value = [ /\/aa\/g/gim, /\/aa\/g/g ];
assert.deepEqual(actual_value, expected_value);
}());
(function test_katex_throws_unexpected_exceptions() {
katex.renderToString = function () { throw new Error('some-exception'); };
var blueslip_error_called = false;
blueslip.error = function (ex) {
assert.equal(ex.message, 'some-exception');
blueslip_error_called = true;
};
var message = { raw_content: '$$a$$' };
markdown.apply_markdown(message);
assert(blueslip_error_called);
}());