From 2cff700e3e59adc2bfcd4b2c536675dfdeb96312 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Sun, 9 Sep 2018 03:50:48 -0400 Subject: js: rm test.js, add test/{test.html,*.js} based on mocha/chai --- js/test/errors.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 js/test/errors.js (limited to 'js/test/errors.js') diff --git a/js/test/errors.js b/js/test/errors.js new file mode 100644 index 0000000..3ce96d5 --- /dev/null +++ b/js/test/errors.js @@ -0,0 +1,34 @@ +(function() { + 'use strict'; + var assert = chai.assert; + + it('unknown key error', function() { + assert.throws(function() { + var r = LuigiTemplate.run('foo%{unknown-key}', { + bar: 'foo', + }); + }, Error, /^unknown key/); + }); + + it('unknown filter error', function() { + assert.throws(function() { + var r = LuigiTemplate.run('foo%{bar | unknown-filter}', { + bar: 'foo', + }); + }, Error, /^unknown filter/); + }); + + it('unknown template error', function() { + assert.throws(function() { + var cache = new LuigiTemplate.Cache({ + foo: [ + 'foo%{bar}', + ], + }); + + var r = cache.run('unknown-template', { + bar: 'foo', + }); + }, Error, /^unknown template/); + }); +})(); -- cgit v1.2.3