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/cache.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 js/test/cache.js (limited to 'js/test/cache.js') diff --git a/js/test/cache.js b/js/test/cache.js new file mode 100644 index 0000000..39dd46d --- /dev/null +++ b/js/test/cache.js @@ -0,0 +1,32 @@ +(function() { + 'use strict'; + var assert = chai.assert; + + it('cache', function() { + var cache = new LuigiTemplate.Cache({ + foo: ['foo%{bar}'], + }); + + var r = cache.run('foo', { + bar: 'foo', + }); + + assert.equal(r, 'foofoo'); + }); + + it('cache with custom filters', function() { + var cache = new LuigiTemplate.Cache({ + foo: ['foo%{bar | barify}'], + }, { + barify: function(s) { + return 'bar-' + s + '-bar'; + }, + }); + + var r = cache.run('foo', { + bar: 'foo', + }); + + assert.equal(r, 'foobar-foo-bar'); + }); +})(); -- cgit v1.2.3