1 Star 0 Fork 0

animalcoder/Vue

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
blob.js 1.04 KB
一键复制 编辑 原始数据 按行查看 历史
animalcoder 提交于 2020-03-17 14:52 +08:00 . Vueinit
'use strict';
var assert = require('assert');
var hash = require('../index');
if (typeof Blob !== 'undefined') {
describe('hash()ing Blob objects', function() {
var blob;
before('create blob', function() {
try {
blob = new Blob(['ABC']);
} catch(e) {
// https://github.com/ariya/phantomjs/issues/11013
if (!e.message.match(/'\[object BlobConstructor\]' is not a constructor/)) {
throw e;
}
var builder = new WebKitBlobBuilder();
builder.append('ABC');
blob = builder.getBlob();
}
});
it('should throw when trying to hash a blob', function() {
assert.throws(function() {
hash(blob);
}, /not supported/);
assert.throws(function() {
hash({abcdef: blob});
}, /not supported/);
});
it('should not throw when trying to hash a blob with ignoreUnknown', function() {
var opt = {ignoreUnknown: true};
assert.ok(validSha1.test(hash(blob, opt)), 'ignore Blob');
assert.ok(validSha1.test(hash({abcdef: blob}, opt)), 'ignore Blob');
});
});
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/animalcoder/Vue.git
git@gitee.com:animalcoder/Vue.git
animalcoder
Vue
Vue
master

搜索帮助