Skip to content

Commit a9b55a8

Browse files
committed
use Buffer.isBuffer(b) to test that randomBytes returns a buffer, not instanceof
1 parent 72336c9 commit a9b55a8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

test/random-bytes.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ var crypto = require('../')
44
test('randomBytes', function (t) {
55
t.plan(5);
66
t.equal(crypto.randomBytes(10).length, 10);
7-
t.ok(crypto.randomBytes(10) instanceof Buffer);
7+
t.ok(Buffer.isBuffer(crypto.randomBytes(10)))
88
crypto.randomBytes(10, function(ex, bytes) {
99
t.error(ex);
1010
t.equal(bytes.length, 10);
11-
t.ok(bytes instanceof Buffer);
11+
t.ok(Buffer.isBuffer(bytes))
1212
t.end();
1313
});
1414
});
@@ -30,7 +30,7 @@ test('randomBytes seem random', function (t) {
3030

3131
var expected = 256/2
3232
var smean = Math.sqrt(mean)
33-
33+
console.log(expected - smean, mean, expected + smean)
3434
t.ok(mean < expected + smean)
3535
t.ok(mean > expected - smean)
3636

0 commit comments

Comments
 (0)