Update checked-in dependencies
This commit is contained in:
parent
5a67cbafe6
commit
a40becf6e4
28 changed files with 277 additions and 86 deletions
32
node_modules/md5/test.js
generated
vendored
32
node_modules/md5/test.js
generated
vendored
|
|
@ -3,12 +3,16 @@ var assert = require('assert');
|
|||
|
||||
describe('md5', function () {
|
||||
|
||||
it('should throw an error for `undefined`', function() {
|
||||
it('should throw an error for an undefined value', function() {
|
||||
assert.throws(function() {
|
||||
md5(undefined);
|
||||
});
|
||||
});
|
||||
|
||||
it('should allow the hashing of the string `undefined`', function() {
|
||||
assert.equal('5e543256c480ac577d30f76f9120eb74', md5('undefined'));
|
||||
});
|
||||
|
||||
it('should throw an error for `null`', function() {
|
||||
assert.throws(function() {
|
||||
md5(null);
|
||||
|
|
@ -42,4 +46,30 @@ describe('md5', function () {
|
|||
var hash3 = md5(hash1 + 'a', { encoding : 'binary' });
|
||||
assert.equal(hash3, '131f0ac52813044f5110e4aec638c169');
|
||||
});
|
||||
|
||||
it('should support Uint8Array', function() {
|
||||
// Polyfills
|
||||
if (!Array.from) {
|
||||
Array.from = function(src, fn) {
|
||||
var result = new Array(src.length);
|
||||
for (var i = 0; i < src.length; ++i)
|
||||
result[i] = fn(src[i]);
|
||||
return result;
|
||||
};
|
||||
}
|
||||
if (!Uint8Array.from) {
|
||||
Uint8Array.from = function(src) {
|
||||
var result = new Uint8Array(src.length);
|
||||
for (var i = 0; i < src.length; ++i)
|
||||
result[i] = src[i];
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
var message = 'foobarbaz';
|
||||
var u8arr = Uint8Array.from(
|
||||
Array.from(message, function(c) { return c.charCodeAt(0); }));
|
||||
var u8aHash = md5(u8arr);
|
||||
assert.equal(u8aHash, md5(message));
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue