Skip to content

Commit 9bf8520

Browse files
committed
test that the error message is right, or a buffer is returned
1 parent 9284566 commit 9bf8520

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/random-bytes.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
var test = require('tape')
22
var crypto = require('../')
33

4+
test('get error message', function (t) {
5+
6+
try {
7+
var b = crypto.randomBytes(10)
8+
t.ok(Buffer.isBuffer(b))
9+
t.end()
10+
} catch (err) {
11+
t.ok(/not supported/.test(err.message), '"not supported" is in error message')
12+
t.end()
13+
}
14+
15+
})
16+
417
test('randomBytes', function (t) {
518
t.plan(5);
619
t.equal(crypto.randomBytes(10).length, 10);

0 commit comments

Comments
 (0)