summaryrefslogtreecommitdiff
path: root/js/test/errors.js
blob: 3ce96d564e63dea47cbb803473c56e5a4be25711 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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/);
  });
})();