[Pkg-javascript-commits] [node-jade] 26/72: Add test for last commit

Jelmer Vernooij jelmer at moszumanska.debian.org
Sun Jul 3 18:03:26 UTC 2016


This is an automated email from the git hooks/post-receive script.

jelmer pushed a commit to annotated tag upstream/1.0.0
in repository node-jade.

commit 6e87fc72db73a03ec63a2b545bfaf78ddd57e056
Author: Timothy Gu <timothygu99 at gmail.com>
Date:   Mon Apr 13 19:54:37 2015 -0700

    Add test for last commit
---
 test/render-async.js | 17 +++++++++++++++++
 test/render.js       | 14 ++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/test/render-async.js b/test/render-async.js
index 085064a..74b9229 100644
--- a/test/render-async.js
+++ b/test/render-async.js
@@ -109,6 +109,23 @@ test('renderAsync - with tr.compile(src, options) => fn', function (override) {
   };
   assert(tr.renderAsync('example input', sentinel, cbSentinel) === normalizedSentinel);
 });
+test('renderAsync(src, options, locals) - with tr.compile(src, options) => fn', function (override) {
+  var nameSentinel = 'jstransformer';
+  override('normalizeAsync', function (result) {
+    return result;
+  });
+  var tr = createTransformer({
+    name: 'test',
+    outputFormat: 'html',
+    compile: function (str, options) {
+      return function (locals) { return String(locals.name); };
+    }
+  });
+  tr.renderAsync('example input', { blah: true }, { name: nameSentinel })
+    .then(function (res) {
+      assert.equal( res.body, nameSentinel)
+    })
+});
 test('renderAsync - without tr.render', function () {
   var tr = createTransformer({
     name: 'test',
diff --git a/test/render.js b/test/render.js
index c490a77..f008258 100644
--- a/test/render.js
+++ b/test/render.js
@@ -56,6 +56,20 @@ test('render - with tr.compile(src, options) => fn', function (override) {
   });
   assert(tr.render('example input', sentinel) === normalizedSentinel);
 });
+test('render(src, options, locals) - with tr.compile(src, options) => fn', function (override) {
+  var nameSentinel = 'jstransformer';
+  var tr = createTransformer({
+    name: 'test',
+    outputFormat: 'html',
+    compile: function (str, options) {
+      return function (locals) { return String(locals.name); };
+    }
+  });
+  assert.equal( tr.render( 'example input'
+                        , { blah: true }
+                        , { name: nameSentinel }).body
+              , nameSentinel);
+});
 test('render - without tr.render', function () {
   var tr = createTransformer({
     name: 'test',

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-jade.git



More information about the Pkg-javascript-commits mailing list