[Pkg-javascript-commits] [node-randomfill] 11/47: test: throw on errors

Bastien Roucariès rouca at moszumanska.debian.org
Fri Dec 15 09:52:51 UTC 2017


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

rouca pushed a commit to branch master
in repository node-randomfill.

commit 22ae5ad8ad2c72e144341e6a7f15fb1b2e59f8c6
Author: Daniel Cousens <github at dcousens.com>
Date:   Fri Mar 27 12:53:32 2015 +1100

    test: throw on errors
---
 test.js | 32 +++++++++++++++++++++-----------
 1 file changed, 21 insertions(+), 11 deletions(-)

diff --git a/test.js b/test.js
index 5a6648c..51a80cc 100644
--- a/test.js
+++ b/test.js
@@ -8,17 +8,27 @@ test('sync', function (t) {
     t.equals(randomBytes(300).length, 300, 'len: ' + 300);
 });
 test('async', function (t) {
-    t.plan(3);
-    randomBytes(3, function (err, resp) {
-      t.equals(resp.length, 3, 'len: ' + 3);
-    });
-    randomBytes(30, function (err, resp) {
-      t.equals(resp.length, 30, 'len: ' + 30);
-    });
-    randomBytes(300, function (err, resp) {
-      t.equals(resp.length, 300, 'len: ' + 300);
-    });
-});
+  t.plan(3)
+
+  randomBytes(3, function (err, resp) {
+    if (err) throw err
+
+    t.equals(resp.length, 3, 'len: ' + 3)
+  })
+
+  randomBytes(30, function (err, resp) {
+    if (err) throw err
+
+    t.equals(resp.length, 30, 'len: ' + 30)
+  })
+
+  randomBytes(300, function (err, resp) {
+    if (err) throw err
+
+    t.equals(resp.length, 300, 'len: ' + 300)
+  })
+})
+
 if (process.browser) {
   test('requesting to much throws', function (t) {
     t.plan(1);

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



More information about the Pkg-javascript-commits mailing list