diff options
author | Paul Duncan <pabs@pablotron.org> | 2018-09-09 03:50:48 -0400 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2018-09-09 03:50:48 -0400 |
commit | 2cff700e3e59adc2bfcd4b2c536675dfdeb96312 (patch) | |
tree | dfe4eb712a521e3a4bd5d4ae3113ab6f7053684f /js/test/cache.js | |
parent | fc93b32955b3a30ad884e4a9b14ebe052b86f120 (diff) | |
download | luigi-template-2cff700e3e59adc2bfcd4b2c536675dfdeb96312.tar.bz2 luigi-template-2cff700e3e59adc2bfcd4b2c536675dfdeb96312.zip |
js: rm test.js, add test/{test.html,*.js} based on mocha/chai
Diffstat (limited to 'js/test/cache.js')
-rw-r--r-- | js/test/cache.js | 32 |
1 files changed, 32 insertions, 0 deletions
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'); + }); +})(); |