mirror of
				https://github.com/openpgpjs/openpgpjs.git
				synced 2025-10-14 00:59:29 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			54 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			54 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| // Old browser polyfills
 | |
| if (typeof Symbol === 'undefined') {
 | |
|   require('core-js/fn/symbol');
 | |
| }
 | |
| if (typeof Promise === 'undefined') {
 | |
|   require('core-js/fn/promise');
 | |
| }
 | |
| 
 | |
| (typeof window !== 'undefined' ? window : global).resolves = function(val) {
 | |
|   return new Promise(function(res) { res(val); });
 | |
| };
 | |
| 
 | |
| (typeof window !== 'undefined' ? window : global).rejects = function(val) {
 | |
|   return new Promise(function(res, rej) { rej(val); });
 | |
| };
 | |
| 
 | |
| (typeof window !== 'undefined' ? window : global).tryTests = function(name, tests, options) {
 | |
|   if (options.if) {
 | |
|     describe(name, function() {
 | |
|       if (options.before) { before(options.before); }
 | |
|       if (options.beforeEach) { beforeEach(options.beforeEach); }
 | |
| 
 | |
|       tests();
 | |
| 
 | |
|       if (options.afterEach) { afterEach(options.afterEach); }
 | |
|       if (options.after) { after(options.after); }
 | |
|     });
 | |
|   } else {
 | |
|     describe.skip(name + ' (no support --> skipping tests)', tests);
 | |
|   }
 | |
| };
 | |
| 
 | |
| describe('Unit Tests', function () {
 | |
| 
 | |
|   if (typeof window !== 'undefined') {
 | |
|     afterEach(function () {
 | |
|       if (window.scrollY >= document.body.scrollHeight - window.innerHeight - 100) {
 | |
|         window.scrollTo(0, document.body.scrollHeight);
 | |
|       }
 | |
|     });
 | |
| 
 | |
|     window.location.search.substr(1).split('&').forEach(param => {
 | |
|       const [key, value] = param.split('=');
 | |
|       if (key && key !== 'grep') {
 | |
|         openpgp.config[key] = JSON.parse(value);
 | |
|       }
 | |
|     });
 | |
|   }
 | |
| 
 | |
|   require('./crypto');
 | |
|   require('./general');
 | |
|   require('./worker');
 | |
| });
 | 
