summaryrefslogtreecommitdiff
path: root/js/test/cache.js
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2018-09-09 03:59:46 -0400
committerPaul Duncan <pabs@pablotron.org>2018-09-09 03:59:46 -0400
commit7c2a6f215734d29f3be8c0a0c85307e896f48155 (patch)
tree5e65cafa8c73a4ebb1b4fa6f5a4f048b4ca9752c /js/test/cache.js
parentfd0050d21c132f1c6cc2673ce1cc964d448b70c3 (diff)
downloadluigi-template-7c2a6f215734d29f3be8c0a0c85307e896f48155.tar.bz2
luigi-template-7c2a6f215734d29f3be8c0a0c85307e896f48155.zip
js: add cache singleton, support non-array cache templates
Diffstat (limited to 'js/test/cache.js')
-rw-r--r--js/test/cache.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/js/test/cache.js b/js/test/cache.js
index 39dd46d..0b68b3d 100644
--- a/js/test/cache.js
+++ b/js/test/cache.js
@@ -4,6 +4,18 @@
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 array', function() {
+ var cache = new LuigiTemplate.Cache({
foo: ['foo%{bar}'],
});
@@ -14,6 +26,19 @@
assert.equal(r, 'foofoo');
});
+ it('cache singleton', function() {
+ var cache = 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}'],