From 589fbb19d6b1f486a0da2206b7fa052e9a5a00f3 Mon Sep 17 00:00:00 2001 From: Justin Chase Date: Sat, 25 Nov 2017 12:24:53 -0600 Subject: [PATCH] Added a test to verify error message --- test/general/openpgp.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/general/openpgp.js b/test/general/openpgp.js index 36199f97..eadf3443 100644 --- a/test/general/openpgp.js +++ b/test/general/openpgp.js @@ -1202,6 +1202,19 @@ describe('OpenPGP.js public api tests', function() { }); describe('Errors', function() { + it('Errors stack should contain the stack of innerError', function(done) { + openpgp.encrypt({ + data: new Uint8Array([0x01, 0x01, 0x01]), + passwords: null + }) + .then(function() { + done(new Error('Error expected.')); + }) + .catch(function(error) { + expect(error.stack).to.match(/\nError: No keys or passwords/); + done(); + }); + }); it('Errors should contain innerError', function(done) { openpgp.encrypt({ data: new Uint8Array([0x01, 0x01, 0x01]),