From 2a504e4e1aa63f0240634a6b8bb872bcb59c8ef9 Mon Sep 17 00:00:00 2001 From: mmso Date: Tue, 13 Feb 2018 17:21:20 +0100 Subject: [PATCH] Disable spy call expecations on the web worker --- test/general/openpgp.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/test/general/openpgp.js b/test/general/openpgp.js index 9c502fc6..0990f3b3 100644 --- a/test/general/openpgp.js +++ b/test/general/openpgp.js @@ -210,6 +210,11 @@ function withCompression(tests) { return options; }, function() { + // Disable the call expectations when using the web worker because it's not possible to spy on what functions get called. + if (openpgp.getWorker()) { + return; + } + if (compression === openpgp.enums.compression.uncompressed) { expect(compressSpy.called).to.be.false; expect(decompressSpy.called).to.be.false; @@ -632,7 +637,6 @@ describe('OpenPGP.js public api tests', function() { sessionKeys: decryptedSessionKeys[0], message }); - }).then(function (decrypted) { expect(decrypted.data).to.equal(plaintext); verifyCompressionDecrypted(decrypted); @@ -1382,14 +1386,13 @@ describe('OpenPGP.js public api tests', function() { publicKeys: pubKeyDE, message: openpgp.message.readArmored(encrypted.data) }); - }).then(function (encrypted) { - expect(encrypted.data).to.exist; - expect(encrypted.data).to.equal(plaintext); - expect(encrypted.signatures[0].valid).to.be.true; - verifyCompressionDecrypted(encrypted); + }).then(function (decrypted) { + expect(decrypted.data).to.exist; + expect(decrypted.data).to.equal(plaintext); + expect(decrypted.signatures[0].valid).to.be.true; return privKeyDE.verifyPrimaryUser().then(() => { - expect(encrypted.signatures[0].keyid.toHex()).to.equal(privKeyDE.getSigningKeyPacket().getKeyId().toHex()); - expect(encrypted.signatures[0].signature.packets.length).to.equal(1); + expect(decrypted.signatures[0].keyid.toHex()).to.equal(privKeyDE.getSigningKeyPacket().getKeyId().toHex()); + expect(decrypted.signatures[0].signature.packets.length).to.equal(1); }); }); });