Skip to content

Commit e93a9c8

Browse files
committed
fix tests
1 parent 5c0a9d9 commit e93a9c8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

test/test.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ var Buffer = require('safe-buffer').Buffer;
66

77
var Sha1 = require('../').sha1;
88

9+
10+
let nodeSupportsUint16 = false
11+
try {
12+
crypto.createHash('sha1').update(new Uint16Array())
13+
nodeSupportsUint16 = true
14+
} catch (err) {}
15+
916
var inputs = [
1017
['', 'ascii'],
1118
['abc', 'ascii'],
@@ -16,7 +23,8 @@ var inputs = [
1623
['0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcde', 'ascii'],
1724
['0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef', 'ascii'],
1825
['foobarbaz', 'ascii'],
19-
typeof Uint16Array === 'function' ? [new Uint16Array([1, 2, 3])] : null
26+
[Buffer.from('buffer')],
27+
nodeSupportsUint16 ? [new Uint16Array([1, 2, 3])] : null
2028
].filter(Boolean);
2129

2230
tape("hash is the same as node's crypto", function (t) {

0 commit comments

Comments
 (0)