tree shake sinon to just get what we need

This commit is contained in:
Bart Butler 2018-02-26 14:45:05 -08:00
parent e939d9b1ab
commit 0186ca8a24

View File

@ -2,7 +2,8 @@
const openpgp = typeof window !== 'undefined' && window.openpgp ? window.openpgp : require('../../dist/openpgp'); const openpgp = typeof window !== 'undefined' && window.openpgp ? window.openpgp : require('../../dist/openpgp');
const sinon = require('sinon'); const spy = require('sinon/lib/sinon/spy');
const stub = require('sinon/lib/sinon/stub');
const chai = require('chai'); const chai = require('chai');
chai.use(require('chai-as-promised')); chai.use(require('chai-as-promised'));
@ -314,8 +315,8 @@ function withCompression(tests) {
let decompressSpy; let decompressSpy;
beforeEach(function () { beforeEach(function () {
compressSpy = sinon.spy(openpgp.packet.Compressed.prototype, 'compress'); compressSpy = spy(openpgp.packet.Compressed.prototype, 'compress');
decompressSpy = sinon.spy(openpgp.packet.Compressed.prototype, 'decompress'); decompressSpy = spy(openpgp.packet.Compressed.prototype, 'decompress');
}); });
afterEach(function () { afterEach(function () {
@ -388,9 +389,9 @@ describe('OpenPGP.js public api tests', function() {
}; };
} }
}; };
keyGenStub = sinon.stub(openpgp.key, 'generate'); keyGenStub = stub(openpgp.key, 'generate');
keyGenStub.returns(resolves(keyObjStub)); keyGenStub.returns(resolves(keyObjStub));
getWebCryptoAllStub = sinon.stub(openpgp.util, 'getWebCryptoAll'); getWebCryptoAllStub = stub(openpgp.util, 'getWebCryptoAll');
}); });
afterEach(function() { afterEach(function() {
@ -523,7 +524,7 @@ describe('OpenPGP.js public api tests', function() {
openpgp.initWorker({ openpgp.initWorker({
worker: workerStub worker: workerStub
}); });
const proxyGenStub = sinon.stub(openpgp.getWorker(), 'delegate'); const proxyGenStub = stub(openpgp.getWorker(), 'delegate');
getWebCryptoAllStub.returns(); getWebCryptoAllStub.returns();
openpgp.generateKey(); openpgp.generateKey();