[Pkg-javascript-commits] [node-async] 366/480: Refactor unmemoize test to use async example

Jonas Smedegaard js at moszumanska.debian.org
Fri May 2 08:58:42 UTC 2014


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

js pushed a commit to branch master
in repository node-async.

commit f81ef1994f8093c3ed4445bacc02c8975312f9b3
Author: Ryan Graham <r.m.graham at gmail.com>
Date:   Sat Nov 23 22:20:23 2013 -0800

    Refactor unmemoize test to use async example
    
    Uses async.setImmediate to make example async
---
 test/test-async.js | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/test/test-async.js b/test/test-async.js
index 17e6fc5..e2690f2 100755
--- a/test/test-async.js
+++ b/test/test-async.js
@@ -2265,24 +2265,24 @@ exports['unmemoize'] = function(test) {
 
     var fn = function (arg1, arg2, callback) {
         call_order.push(['fn', arg1, arg2]);
-        callback(null, arg1 + arg2);
+        async.setImmediate(function () {
+            callback(null, arg1 + arg2);
+        });
     };
 
     var fn2 = async.memoize(fn);
     var fn3 = async.unmemoize(fn2);
     fn3(1, 2, function (err, result) {
         test.equal(result, 3);
+        fn3(1, 2, function (err, result) {
+            test.equal(result, 3);
+            fn3(2, 2, function (err, result) {
+                test.equal(result, 4);
+                test.same(call_order, [['fn',1,2], ['fn',1,2], ['fn',2,2]]);
+                test.done();
+            });
+        });
     });
-    fn3(1, 2, function (err, result) {
-        test.equal(result, 3);
-    });
-    fn3(2, 2, function (err, result) {
-        test.equal(result, 4);
-    });
-
-    test.same(call_order, [['fn',1,2], ['fn',1,2], ['fn',2,2]]);
-
-    test.done();
 }
 
 exports['unmemoize a not memoized function'] = function(test) {

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



More information about the Pkg-javascript-commits mailing list