aboutsummaryrefslogtreecommitdiffstats
path: root/lang/js/BrowserTestExtension/tests/longRunningTests.js
diff options
context:
space:
mode:
Diffstat (limited to 'lang/js/BrowserTestExtension/tests/longRunningTests.js')
-rw-r--r--lang/js/BrowserTestExtension/tests/longRunningTests.js76
1 files changed, 26 insertions, 50 deletions
diff --git a/lang/js/BrowserTestExtension/tests/longRunningTests.js b/lang/js/BrowserTestExtension/tests/longRunningTests.js
index e148d1cf..03f0390c 100644
--- a/lang/js/BrowserTestExtension/tests/longRunningTests.js
+++ b/lang/js/BrowserTestExtension/tests/longRunningTests.js
@@ -20,61 +20,37 @@
* Author(s):
* Maximilian Krambach <[email protected]>
*/
-/* global describe, it, expect, Gpgmejs */
+/* global describe, it, before, expect, Gpgmejs */
/* global bigString, inputvalues */
describe('Long running Encryption/Decryption', function () {
+ let context = null;
+ const good_fpr = inputvalues.encrypt.good.fingerprint;
+ before(function(done){
+ const prm = Gpgmejs.init();
+ prm.then(function(gpgmejs){
+ context = gpgmejs;
+ done();
+ });
+ });
+
for (let i=0; i < 101; i++) {
- it('Successful encrypt/decrypt completely random data ' +
- (i+1) + '/100', function (done) {
- let prm = Gpgmejs.init();
- let data = bigString(2*1024*1024);
- prm.then(function (context) {
- context.encrypt(data,
- inputvalues.encrypt.good.fingerprint).then(
- function (answer){
- expect(answer).to.not.be.empty;
- expect(answer.data).to.be.a('string');
- expect(answer.data).to.include(
- 'BEGIN PGP MESSAGE');
- expect(answer.data).to.include(
- 'END PGP MESSAGE');
- context.decrypt(answer.data).then(
- function(result){
- expect(result).to.not.be.empty;
- expect(result.data).to.be.a('string');
- /*
- if (result.data.length !== data.length) {
- console.log('diff: ' +
- (result.data.length - data.length));
- for (let i=0; i < result.data.length; i++){
- if (result.data[i] !== data[i]){
- console.log('position: ' + i);
- console.log('result : ' +
- result.data.charCodeAt(i) +
- result.data[i-2] +
- result.data[i-1] +
- result.data[i] +
- result.data[i+1] +
- result.data[i+2]);
- console.log('original: ' +
- data.charCodeAt(i) +
- data[i-2] +
- data[i-1] +
- data[i] +
- data[i+1] +
- data[i+2]);
- break;
- }
- }
- }
- */
- expect(result.data).to.equal(data);
- done();
- });
- });
+ it('Successful encrypt/decrypt completely random data '
+ + (i+1) + '/100', function (done) {
+ const data = bigString(2*1024*1024);
+ context.encrypt(data,good_fpr).then(function (answer){
+ expect(answer).to.not.be.empty;
+ expect(answer.data).to.be.a('string');
+ expect(answer.data).to.include('BEGIN PGP MESSAGE');
+ expect(answer.data).to.include('END PGP MESSAGE');
+ context.decrypt(answer.data).then(function(result){
+ expect(result).to.not.be.empty;
+ expect(result.data).to.be.a('string');
+ expect(result.data).to.equal(data);
+ done();
+ });
});
- }).timeout(8000);
+ }).timeout(15000);
}
});