mirror of https://github.com/BTCPrivate/copay.git
Merge pull request #681 from ryanxcharles/bug/fix-mocha-browser-tests
make mocha browser tests all run with no console errors
This commit is contained in:
commit
3053dfc005
8
copay.js
8
copay.js
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
// core
|
// core
|
||||||
module.exports.PublicKeyRing = require('./js/models/core/PublicKeyRing');
|
module.exports.PublicKeyRing = require('./js/models/core/PublicKeyRing');
|
||||||
module.exports.TxProposals = require('./js/models/core/TxProposals');
|
module.exports.TxProposals = require('./js/models/core/TxProposals');
|
||||||
|
@ -14,11 +13,6 @@ var Insight = module.exports.Insight = require('./js/models/blockchain/Insight')
|
||||||
var StorageLocalPlain = module.exports.StorageLocalPlain = require('./js/models/storage/LocalPlain');
|
var StorageLocalPlain = module.exports.StorageLocalPlain = require('./js/models/storage/LocalPlain');
|
||||||
var StorageLocalEncrypted = module.exports.StorageLocalEncrypted = require('./js/models/storage/LocalEncrypted');
|
var StorageLocalEncrypted = module.exports.StorageLocalEncrypted = require('./js/models/storage/LocalEncrypted');
|
||||||
|
|
||||||
var WalletFactory = require('soop').load('./js/models/core/WalletFactory',{
|
module.exports.WalletFactory = require('./js/models/core/WalletFactory');
|
||||||
Network: WebRTC,
|
|
||||||
Blockchain: Insight,
|
|
||||||
Storage: StorageLocalEncrypted,
|
|
||||||
});
|
|
||||||
module.exports.WalletFactory = WalletFactory;
|
|
||||||
module.exports.version = require('./version');
|
module.exports.version = require('./version');
|
||||||
module.exports.API = require('./API');
|
module.exports.API = require('./API');
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var imports = require('soop').imports();
|
var imports = require('soop').imports();
|
||||||
var Storage = imports.Storage;
|
|
||||||
var Network = imports.Network;
|
|
||||||
var Blockchain = imports.Blockchain;
|
|
||||||
|
|
||||||
var TxProposals = require('./TxProposals');
|
var TxProposals = require('./TxProposals');
|
||||||
var PublicKeyRing = require('./PublicKeyRing');
|
var PublicKeyRing = require('./PublicKeyRing');
|
||||||
var PrivateKey = require('./PrivateKey');
|
var PrivateKey = require('./PrivateKey');
|
||||||
var Wallet = require('./Wallet');
|
var Wallet = require('./Wallet');
|
||||||
|
|
||||||
|
var WebRTC = module.exports.WebRTC = require('../network/WebRTC');
|
||||||
|
var Insight = module.exports.Insight = require('../blockchain/Insight');
|
||||||
|
//var StorageLocalPlain = module.exports.StorageLocalPlain = require('../storage/LocalPlain');
|
||||||
|
var StorageLocalEncrypted = module.exports.StorageLocalEncrypted = require('../storage/LocalEncrypted');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* WalletFactory
|
* WalletFactory
|
||||||
*
|
*
|
||||||
|
@ -19,9 +21,13 @@ function WalletFactory(config, version) {
|
||||||
var self = this;
|
var self = this;
|
||||||
config = config || {};
|
config = config || {};
|
||||||
|
|
||||||
this.storage = new Storage(config.storage);
|
this.Storage = config.Storage || StorageLocalEncrypted;
|
||||||
this.network = new Network(config.network);
|
this.Network = config.Network || WebRTC;
|
||||||
this.blockchain = new Blockchain(config.blockchain);
|
this.Blockchain = config.Blockchain || Insight;
|
||||||
|
|
||||||
|
this.storage = new this.Storage(config.storage);
|
||||||
|
this.network = new this.Network(config.network);
|
||||||
|
this.blockchain = new this.Blockchain(config.blockchain);
|
||||||
|
|
||||||
this.networkName = config.networkName;
|
this.networkName = config.networkName;
|
||||||
this.verbose = config.verbose;
|
this.verbose = config.verbose;
|
||||||
|
|
|
@ -14,9 +14,6 @@
|
||||||
<script>mocha.setup('bdd')</script>
|
<script>mocha.setup('bdd')</script>
|
||||||
<script src="../lib/bitcore/browser/bundle.js"></script>
|
<script src="../lib/bitcore/browser/bundle.js"></script>
|
||||||
<script src="../js/copayBundle.js"></script>
|
<script src="../js/copayBundle.js"></script>
|
||||||
<script>
|
|
||||||
var copay = require('copay');
|
|
||||||
</script>
|
|
||||||
<script src="test.blockchain.Insight.js"></script>
|
<script src="test.blockchain.Insight.js"></script>
|
||||||
<script src="test.PrivateKey.js"></script>
|
<script src="test.PrivateKey.js"></script>
|
||||||
<script src="test.PublicKeyRing.js"></script>
|
<script src="test.PublicKeyRing.js"></script>
|
||||||
|
@ -24,7 +21,7 @@
|
||||||
<script src="test.storage.LocalPlain.js"></script>
|
<script src="test.storage.LocalPlain.js"></script>
|
||||||
<script src="test.TxProposals.js"></script>
|
<script src="test.TxProposals.js"></script>
|
||||||
<script src="test.Wallet.js"></script>
|
<script src="test.Wallet.js"></script>
|
||||||
<script src="test.Walletfactory.js"></script>
|
<script src="test.WalletFactory.js"></script>
|
||||||
<script src="test.performance.js"></script>
|
<script src="test.performance.js"></script>
|
||||||
<!--
|
<!--
|
||||||
-->
|
-->
|
||||||
|
|
|
@ -2,7 +2,11 @@
|
||||||
|
|
||||||
var chai = chai || require('chai');
|
var chai = chai || require('chai');
|
||||||
var should = chai.should();
|
var should = chai.should();
|
||||||
var copay = copay || require('../copay');
|
try {
|
||||||
|
var copay = require('copay'); //browser
|
||||||
|
} catch (e) {
|
||||||
|
var copay = require('../copay'); //node
|
||||||
|
}
|
||||||
var API = API || copay.API;
|
var API = API || copay.API;
|
||||||
var Storage = Storage || require('../test/mocks/FakeStorage');
|
var Storage = Storage || require('../test/mocks/FakeStorage');
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,11 @@ var should = chai.should();
|
||||||
var bitcore = bitcore || require('bitcore');
|
var bitcore = bitcore || require('bitcore');
|
||||||
var Address = bitcore.Address;
|
var Address = bitcore.Address;
|
||||||
var buffertools = bitcore.buffertools;
|
var buffertools = bitcore.buffertools;
|
||||||
var copay = copay || require('../copay');
|
try {
|
||||||
|
var copay = require('copay'); //browser
|
||||||
|
} catch (e) {
|
||||||
|
var copay = require('../copay'); //node
|
||||||
|
}
|
||||||
var PublicKeyRing = copay.PublicKeyRing;
|
var PublicKeyRing = copay.PublicKeyRing;
|
||||||
var AddressIndex = copay.AddressIndex;
|
var AddressIndex = copay.AddressIndex;
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,11 @@ var chai = chai || require('chai');
|
||||||
var should = chai.should();
|
var should = chai.should();
|
||||||
var bitcore = bitcore || require('bitcore');
|
var bitcore = bitcore || require('bitcore');
|
||||||
var buffertools = bitcore.buffertools;
|
var buffertools = bitcore.buffertools;
|
||||||
var copay = copay || require('../copay');
|
try {
|
||||||
|
var copay = require('copay'); //browser
|
||||||
|
} catch (e) {
|
||||||
|
var copay = require('../copay'); //node
|
||||||
|
}
|
||||||
var Passphrase = copay.Passphrase;
|
var Passphrase = copay.Passphrase;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,11 +7,15 @@ var Transaction = bitcore.Transaction;
|
||||||
var buffertools = bitcore.buffertools;
|
var buffertools = bitcore.buffertools;
|
||||||
var WalletKey = bitcore.WalletKey;
|
var WalletKey = bitcore.WalletKey;
|
||||||
var Key = bitcore.Key;
|
var Key = bitcore.Key;
|
||||||
var bignum = bitcore.bignum;
|
var bignum = bitcore.Bignum;
|
||||||
var networks = bitcore.networks;
|
var networks = bitcore.networks;
|
||||||
var Address = bitcore.Address;
|
var Address = bitcore.Address;
|
||||||
var BitcorePrivateKey = bitcore.PrivateKey;
|
var BitcorePrivateKey = bitcore.PrivateKey;
|
||||||
var copay = copay || require('../copay');
|
try {
|
||||||
|
var copay = require('copay'); //browser
|
||||||
|
} catch (e) {
|
||||||
|
var copay = require('../copay'); //node
|
||||||
|
}
|
||||||
var PrivateKey = copay.PrivateKey || require('../js/models/core/PrivateKey');
|
var PrivateKey = copay.PrivateKey || require('../js/models/core/PrivateKey');
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
|
|
|
@ -5,16 +5,16 @@ var should = chai.should();
|
||||||
var bitcore = bitcore || require('bitcore');
|
var bitcore = bitcore || require('bitcore');
|
||||||
var Address = bitcore.Address;
|
var Address = bitcore.Address;
|
||||||
var buffertools = bitcore.buffertools;
|
var buffertools = bitcore.buffertools;
|
||||||
var copay = copay || require('../copay');
|
try {
|
||||||
|
var copay = require('copay'); //browser
|
||||||
|
} catch (e) {
|
||||||
|
var copay = require('../copay'); //node
|
||||||
|
}
|
||||||
var PublicKeyRing = copay.PublicKeyRing;
|
var PublicKeyRing = copay.PublicKeyRing;
|
||||||
|
|
||||||
var aMasterPubKey = 'tprv8ZgxMBicQKsPdSVTiWXEqCCzqRaRr9EAQdn5UVMpT9UHX67Dh1FmzEMbavPumpAicsUm2XvC6NTdcWB89yN5DUWx5HQ7z3KByUg7Ht74VRZ';
|
var aMasterPubKey = 'tprv8ZgxMBicQKsPdSVTiWXEqCCzqRaRr9EAQdn5UVMpT9UHX67Dh1FmzEMbavPumpAicsUm2XvC6NTdcWB89yN5DUWx5HQ7z3KByUg7Ht74VRZ';
|
||||||
|
|
||||||
|
|
||||||
var config = {
|
|
||||||
networkName:'livenet',
|
|
||||||
};
|
|
||||||
|
|
||||||
var createW = function (networkName) {
|
var createW = function (networkName) {
|
||||||
var config = {
|
var config = {
|
||||||
networkName: networkName || 'livenet',
|
networkName: networkName || 'livenet',
|
||||||
|
@ -37,6 +37,10 @@ var createW = function (networkName) {
|
||||||
describe('PublicKeyRing model', function() {
|
describe('PublicKeyRing model', function() {
|
||||||
|
|
||||||
it('should create an instance (livenet)', function () {
|
it('should create an instance (livenet)', function () {
|
||||||
|
var config = {
|
||||||
|
networkName:'livenet',
|
||||||
|
};
|
||||||
|
|
||||||
var w = new PublicKeyRing({
|
var w = new PublicKeyRing({
|
||||||
networkName: config.networkName
|
networkName: config.networkName
|
||||||
});
|
});
|
||||||
|
@ -50,6 +54,9 @@ describe('PublicKeyRing model', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should fail to generate shared pub keys wo extended key', function () {
|
it('should fail to generate shared pub keys wo extended key', function () {
|
||||||
|
var config = {
|
||||||
|
networkName:'livenet',
|
||||||
|
};
|
||||||
var w2 = new PublicKeyRing(config);
|
var w2 = new PublicKeyRing(config);
|
||||||
should.exist(w2);
|
should.exist(w2);
|
||||||
|
|
||||||
|
@ -235,6 +242,9 @@ describe('PublicKeyRing model', function() {
|
||||||
|
|
||||||
|
|
||||||
it('#merge pubkey tests', function () {
|
it('#merge pubkey tests', function () {
|
||||||
|
var config = {
|
||||||
|
networkName:'livenet',
|
||||||
|
};
|
||||||
var w = new PublicKeyRing(config);
|
var w = new PublicKeyRing(config);
|
||||||
should.exist(w);
|
should.exist(w);
|
||||||
var copayers = [];
|
var copayers = [];
|
||||||
|
@ -264,6 +274,9 @@ describe('PublicKeyRing model', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('#merge pubkey tests (case 2)', function () {
|
it('#merge pubkey tests (case 2)', function () {
|
||||||
|
var config = {
|
||||||
|
networkName:'livenet',
|
||||||
|
};
|
||||||
var w = new PublicKeyRing(config);
|
var w = new PublicKeyRing(config);
|
||||||
should.exist(w);
|
should.exist(w);
|
||||||
|
|
||||||
|
@ -281,6 +294,9 @@ describe('PublicKeyRing model', function() {
|
||||||
|
|
||||||
|
|
||||||
it('#merge with nickname', function () {
|
it('#merge with nickname', function () {
|
||||||
|
var config = {
|
||||||
|
networkName:'livenet',
|
||||||
|
};
|
||||||
var w = new PublicKeyRing(config);
|
var w = new PublicKeyRing(config);
|
||||||
should.exist(w);
|
should.exist(w);
|
||||||
for(var i=0; i<3; i++) {
|
for(var i=0; i<3; i++) {
|
||||||
|
@ -315,6 +331,9 @@ describe('PublicKeyRing model', function() {
|
||||||
|
|
||||||
|
|
||||||
it('#toObj #fromObj with nickname', function () {
|
it('#toObj #fromObj with nickname', function () {
|
||||||
|
var config = {
|
||||||
|
networkName:'livenet',
|
||||||
|
};
|
||||||
var w = new PublicKeyRing(config);
|
var w = new PublicKeyRing(config);
|
||||||
should.exist(w);
|
should.exist(w);
|
||||||
for(var i=0; i<3; i++) {
|
for(var i=0; i<3; i++) {
|
||||||
|
|
|
@ -3,7 +3,11 @@
|
||||||
var chai = chai || require('chai');
|
var chai = chai || require('chai');
|
||||||
var should = chai.should();
|
var should = chai.should();
|
||||||
var bitcore = bitcore || require('bitcore');
|
var bitcore = bitcore || require('bitcore');
|
||||||
var copay = copay || require('../copay');
|
try {
|
||||||
|
var copay = require('copay'); //browser
|
||||||
|
} catch (e) {
|
||||||
|
var copay = require('../copay'); //node
|
||||||
|
}
|
||||||
var Structure = require('../js/models/core/Structure');
|
var Structure = require('../js/models/core/Structure');
|
||||||
|
|
||||||
describe('Structure model', function() {
|
describe('Structure model', function() {
|
||||||
|
|
|
@ -7,20 +7,24 @@ var Transaction = bitcore.Transaction;
|
||||||
var buffertools = bitcore.buffertools;
|
var buffertools = bitcore.buffertools;
|
||||||
var WalletKey = bitcore.WalletKey;
|
var WalletKey = bitcore.WalletKey;
|
||||||
var Key = bitcore.Key;
|
var Key = bitcore.Key;
|
||||||
var bignum = bitcore.bignum;
|
var bignum = bitcore.Bignum;
|
||||||
var Script = bitcore.Script;
|
var Script = bitcore.Script;
|
||||||
var Builder = bitcore.TransactionBuilder;
|
var Builder = bitcore.TransactionBuilder;
|
||||||
var util = bitcore.util;
|
var util = bitcore.util;
|
||||||
var networks = bitcore.networks;
|
var networks = bitcore.networks;
|
||||||
var copay = copay || require('../copay');
|
try {
|
||||||
|
var copay = require('copay'); //browser
|
||||||
|
} catch (e) {
|
||||||
|
var copay = require('../copay'); //node
|
||||||
|
}
|
||||||
var fakeStorage = copay.FakeStorage;
|
var fakeStorage = copay.FakeStorage;
|
||||||
var PrivateKey = copay.PrivateKey || require('../js/models/PrivateKey');
|
var PrivateKey = copay.PrivateKey || require('../js/models/PrivateKey');
|
||||||
var TxProposals = copay.TxProposals || require('../js/models/TxProposal');
|
var TxProposals = copay.TxProposals || require('../js/models/TxProposal');
|
||||||
|
var is_browser = (typeof process == 'undefined' || typeof process.versions === 'undefined')
|
||||||
var PublicKeyRing = is_browser ? copay.PublicKeyRing :
|
var PublicKeyRing = is_browser ? copay.PublicKeyRing :
|
||||||
require('soop').load('../js/models/core/PublicKeyRing', {
|
require('soop').load('../js/models/core/PublicKeyRing', {
|
||||||
Storage: fakeStorage
|
Storage: fakeStorage
|
||||||
});
|
});
|
||||||
var is_browser = (typeof process.versions === 'undefined')
|
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
networkName: 'testnet',
|
networkName: 'testnet',
|
||||||
|
@ -102,7 +106,7 @@ describe('TxProposals model', function() {
|
||||||
tx = b.build();
|
tx = b.build();
|
||||||
tx.isComplete().should.equal(true);
|
tx.isComplete().should.equal(true);
|
||||||
|
|
||||||
var s = new Script(new Buffer(unspentTest[0].scriptPubKey, 'hex'));
|
var s = new Script(new bitcore.Buffer(unspentTest[0].scriptPubKey, 'hex'));
|
||||||
|
|
||||||
tx.verifyInput(0, s, {
|
tx.verifyInput(0, s, {
|
||||||
verifyP2SH: true,
|
verifyP2SH: true,
|
||||||
|
@ -126,7 +130,7 @@ describe('TxProposals model', function() {
|
||||||
var createTx = function(toAddress, amountSatStr, utxos, opts, priv, pkr) {
|
var createTx = function(toAddress, amountSatStr, utxos, opts, priv, pkr) {
|
||||||
opts = opts || {};
|
opts = opts || {};
|
||||||
|
|
||||||
var amountSat = bitcore.bignum(amountSatStr);
|
var amountSat = bitcore.Bignum(amountSatStr);
|
||||||
|
|
||||||
if (!pkr.isComplete()) {
|
if (!pkr.isComplete()) {
|
||||||
throw new Error('publicKeyRing is not complete');
|
throw new Error('publicKeyRing is not complete');
|
||||||
|
|
|
@ -3,7 +3,11 @@
|
||||||
var chai = chai || require('chai');
|
var chai = chai || require('chai');
|
||||||
var should = chai.should();
|
var should = chai.should();
|
||||||
var sinon = require('sinon');
|
var sinon = require('sinon');
|
||||||
var copay = copay || require('../copay');
|
try {
|
||||||
|
var copay = require('copay'); //browser
|
||||||
|
} catch (e) {
|
||||||
|
var copay = require('../copay'); //node
|
||||||
|
}
|
||||||
var Wallet = require('../js/models/core/Wallet');
|
var Wallet = require('../js/models/core/Wallet');
|
||||||
var Storage = require('./mocks/FakeStorage');
|
var Storage = require('./mocks/FakeStorage');
|
||||||
var Network = require('./mocks/FakeNetwork');
|
var Network = require('./mocks/FakeNetwork');
|
||||||
|
@ -77,7 +81,7 @@ describe('Wallet model', function() {
|
||||||
should.exist(w.privateKey);
|
should.exist(w.privateKey);
|
||||||
should.exist(w.txProposals);
|
should.exist(w.txProposals);
|
||||||
should.exist(w.netKey);
|
should.exist(w.netKey);
|
||||||
var b = new Buffer(w.netKey, 'base64');
|
var b = new bitcore.Buffer(w.netKey, 'base64');
|
||||||
b.toString('hex').length.should.equal(16);
|
b.toString('hex').length.should.equal(16);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -287,6 +291,7 @@ describe('Wallet model', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('call reconnect after interval', function(done) {
|
it('call reconnect after interval', function(done) {
|
||||||
|
this.timeout(10000);
|
||||||
var w = createW2();
|
var w = createW2();
|
||||||
var testTime = 1000;
|
var testTime = 1000;
|
||||||
var callCount = 0;
|
var callCount = 0;
|
||||||
|
@ -539,6 +544,7 @@ describe('Wallet model', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('should create & sign transaction from received funds', function(done) {
|
it('should create & sign transaction from received funds', function(done) {
|
||||||
|
this.timeout(10000);
|
||||||
var w = createW2();
|
var w = createW2();
|
||||||
var pk = w.privateKey;
|
var pk = w.privateKey;
|
||||||
w.privateKey = null;
|
w.privateKey = null;
|
||||||
|
|
|
@ -7,16 +7,12 @@ var FakeNetwork = require('./mocks/FakeNetwork');
|
||||||
var Insight = require('../js/models/blockchain/Insight');
|
var Insight = require('../js/models/blockchain/Insight');
|
||||||
var FakeStorage = require('./mocks/FakeStorage');
|
var FakeStorage = require('./mocks/FakeStorage');
|
||||||
|
|
||||||
var WalletFactory = typeof copay === 'undefined' ? require('soop').load('../js/models/core/WalletFactory', {
|
try {
|
||||||
Network: FakeNetwork,
|
var copay = require('copay'); //browser
|
||||||
Blockchain: Insight,
|
} catch (e) {
|
||||||
Storage: FakeStorage,
|
var copay = require('../copay'); //node
|
||||||
}) : copay.WalletFactory;
|
}
|
||||||
|
var WalletFactory = require('../js/models/core/WalletFactory');
|
||||||
var blanket = require("blanket")({
|
|
||||||
"pattern": "/js/"
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
var addCopayers = function(w) {
|
var addCopayers = function(w) {
|
||||||
for (var i = 0; i < 4; i++) {
|
for (var i = 0; i < 4; i++) {
|
||||||
|
@ -26,11 +22,15 @@ var addCopayers = function(w) {
|
||||||
|
|
||||||
describe('WalletFactory model', function() {
|
describe('WalletFactory model', function() {
|
||||||
var config = {
|
var config = {
|
||||||
|
Network: FakeNetwork,
|
||||||
|
Blockchain: Insight,
|
||||||
|
Storage: FakeStorage,
|
||||||
wallet: {
|
wallet: {
|
||||||
requiredCopayers: 3,
|
requiredCopayers: 3,
|
||||||
totalCopayers: 5,
|
totalCopayers: 5,
|
||||||
spendUnconfirmed: 1,
|
spendUnconfirmed: 1,
|
||||||
reconnectDelay: 100,
|
reconnectDelay: 100,
|
||||||
|
|
||||||
},
|
},
|
||||||
blockchain: {
|
blockchain: {
|
||||||
host: 'test.insight.is',
|
host: 'test.insight.is',
|
||||||
|
@ -82,6 +82,9 @@ describe('WalletFactory model', function() {
|
||||||
|
|
||||||
it('BIP32 length problem', function() {
|
it('BIP32 length problem', function() {
|
||||||
var sconfig = {
|
var sconfig = {
|
||||||
|
Network: FakeNetwork,
|
||||||
|
Blockchain: Insight,
|
||||||
|
Storage: FakeStorage,
|
||||||
"networkName": "testnet",
|
"networkName": "testnet",
|
||||||
"network": {
|
"network": {
|
||||||
"key": "g23ihfh82h35rf",
|
"key": "g23ihfh82h35rf",
|
||||||
|
|
|
@ -3,7 +3,11 @@
|
||||||
var chai = chai || require('chai');
|
var chai = chai || require('chai');
|
||||||
var should = chai.should();
|
var should = chai.should();
|
||||||
var bitcore = bitcore || require('bitcore');
|
var bitcore = bitcore || require('bitcore');
|
||||||
var copay = copay || require('../copay');
|
try {
|
||||||
|
var copay = require('copay'); //browser
|
||||||
|
} catch (e) {
|
||||||
|
var copay = require('../copay'); //node
|
||||||
|
}
|
||||||
var Insight = copay.Insight || require('../js/models/blockchain/Insight');
|
var Insight = copay.Insight || require('../js/models/blockchain/Insight');
|
||||||
|
|
||||||
var ID = '933bf321393459b7';
|
var ID = '933bf321393459b7';
|
||||||
|
|
|
@ -90,7 +90,7 @@ describe("Unit: controllerUtils", function() {
|
||||||
|
|
||||||
|
|
||||||
describe("Unit: Backup Service", function() {
|
describe("Unit: Backup Service", function() {
|
||||||
var sinon = require('../sinon');
|
var sinon = require('sinon');
|
||||||
beforeEach(angular.mock.module('copayApp.services'));
|
beforeEach(angular.mock.module('copayApp.services'));
|
||||||
it('should contain a backup service', inject(function(backupService) {
|
it('should contain a backup service', inject(function(backupService) {
|
||||||
expect(backupService).not.to.equal(null);
|
expect(backupService).not.to.equal(null);
|
||||||
|
|
|
@ -50,7 +50,9 @@ var createBundle = function(opts) {
|
||||||
});
|
});
|
||||||
b.require('./version');
|
b.require('./version');
|
||||||
// b.external('bitcore');
|
// b.external('bitcore');
|
||||||
b.require('./js/models/core/WalletFactory');
|
b.require('./js/models/core/WalletFactory', {
|
||||||
|
expose: '../js/models/core/WalletFactory'
|
||||||
|
});
|
||||||
b.require('./js/models/core/Wallet');
|
b.require('./js/models/core/Wallet');
|
||||||
b.require('./js/models/core/Wallet', {
|
b.require('./js/models/core/Wallet', {
|
||||||
expose: '../js/models/core/Wallet'
|
expose: '../js/models/core/Wallet'
|
||||||
|
@ -58,6 +60,9 @@ var createBundle = function(opts) {
|
||||||
b.require('./test/mocks/FakeStorage', {
|
b.require('./test/mocks/FakeStorage', {
|
||||||
expose: './mocks/FakeStorage'
|
expose: './mocks/FakeStorage'
|
||||||
});
|
});
|
||||||
|
b.require('./test/mocks/FakeBlockchain', {
|
||||||
|
expose: './mocks/FakeBlockchain'
|
||||||
|
});
|
||||||
b.require('./js/models/core/Wallet', {
|
b.require('./js/models/core/Wallet', {
|
||||||
expose: '../js/models/core/Wallet'
|
expose: '../js/models/core/Wallet'
|
||||||
});
|
});
|
||||||
|
@ -81,10 +86,12 @@ var createBundle = function(opts) {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (opts.dontminify) {
|
if (opts.dontminify) {
|
||||||
b.require('sinon', {
|
//include dev dependencies
|
||||||
expose: '../sinon'
|
b.require('sinon');
|
||||||
});
|
b.require('blanket');
|
||||||
|
b.require('soop');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!opts.dontminify) {
|
if (!opts.dontminify) {
|
||||||
b.transform({
|
b.transform({
|
||||||
global: true
|
global: true
|
||||||
|
@ -101,7 +108,7 @@ if (require.main === module) {
|
||||||
var program = require('commander');
|
var program = require('commander');
|
||||||
program
|
program
|
||||||
.version('0.0.1')
|
.version('0.0.1')
|
||||||
.option('-d, --dontminify', 'Don\'t minify the code.')
|
.option('-d, --dontminify', 'Development. Don\'t minify the code.')
|
||||||
.option('-o, --stdout', 'Specify output as stdout')
|
.option('-o, --stdout', 'Specify output as stdout')
|
||||||
.parse(process.argv);
|
.parse(process.argv);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue