test: use is_browser instead of try/catch to detect browser.

This commit is contained in:
Christopher Jeffrey 2014-08-14 12:29:11 -04:00
commit 1c264deb2c
4 changed files with 14 additions and 8 deletions

View file

@ -19,9 +19,11 @@ CryptoJS.AES.decrypt = function(a) {
'use strict';
var chai = chai || require('chai');
var should = chai.should();
try {
var is_browser = typeof process == 'undefined'
|| typeof process.versions === 'undefined';
if (is_browser) {
var copay = require('copay'); //browser
} catch (e) {
} else {
var copay = require('../copay'); //node
}
var LocalEncrypted = copay.StorageLocalEncrypted;