diff --git a/Gruntfile.js b/Gruntfile.js index 04e3537e0..f29432857 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -88,12 +88,12 @@ module.exports = function(grunt) { mochaTest: { tests: { options: { - require: 'test/mocha_node_setup.js', + require: 'setup/node.js', reporter: 'spec', mocha: require('mocha') }, src: [ - 'test/models/*.js', + 'test/*.js', ] } }, diff --git a/karma.conf.js b/karma.conf.js index d2953b68a..c4841e4f7 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -63,8 +63,8 @@ module.exports = function(config) { 'test/mocha.conf.js', //test files - 'karma/setup.js', - 'test/models/*.js', + 'setup/karma.js', + 'test/*.js', 'test/unit/**/*.js', diff --git a/karma/setup.js b/setup/karma.js similarity index 100% rename from karma/setup.js rename to setup/karma.js diff --git a/setup/node.js b/setup/node.js new file mode 100644 index 000000000..7fdf6c8eb --- /dev/null +++ b/setup/node.js @@ -0,0 +1,16 @@ +global.chai = require('chai'); +global.sinon = require('sinon'); +global.bitcore = require('bitcore'); +global.expect = global.chai.expect; +global.bignum = global.bitcore.Bignum; +global.should = global.chai.should(); + +global.copay = require('../copay'); +global.copayConfig = require('../config'); + +global.requireMock = function(name) { + return require('../test/mocks/' + name); +} + +global.is_browser = typeof process == 'undefined' || typeof process.versions === 'undefined'; +global._ = require('underscore'); diff --git a/test/models/HDParams.js b/test/HDParams.js similarity index 100% rename from test/models/HDParams.js rename to test/HDParams.js diff --git a/test/models/HDPath.js b/test/HDPath.js similarity index 100% rename from test/models/HDPath.js rename to test/HDPath.js diff --git a/test/models/Passphrase.js b/test/Passphrase.js similarity index 100% rename from test/models/Passphrase.js rename to test/Passphrase.js diff --git a/test/models/PayPro.js b/test/PayPro.js similarity index 100% rename from test/models/PayPro.js rename to test/PayPro.js diff --git a/test/models/PrivateKey.js b/test/PrivateKey.js similarity index 100% rename from test/models/PrivateKey.js rename to test/PrivateKey.js diff --git a/test/models/PublicKeyRing.js b/test/PublicKeyRing.js similarity index 100% rename from test/models/PublicKeyRing.js rename to test/PublicKeyRing.js diff --git a/test/models/Storage.js b/test/Storage.js similarity index 100% rename from test/models/Storage.js rename to test/Storage.js diff --git a/test/models/TxProposal.js b/test/TxProposal.js similarity index 100% rename from test/models/TxProposal.js rename to test/TxProposal.js diff --git a/test/models/TxProposals.js b/test/TxProposals.js similarity index 100% rename from test/models/TxProposals.js rename to test/TxProposals.js diff --git a/test/models/Wallet.js b/test/Wallet.js similarity index 100% rename from test/models/Wallet.js rename to test/Wallet.js diff --git a/test/models/WalletFactory.js b/test/WalletFactory.js similarity index 100% rename from test/models/WalletFactory.js rename to test/WalletFactory.js diff --git a/test/models/WalletLock.js b/test/WalletLock.js similarity index 100% rename from test/models/WalletLock.js rename to test/WalletLock.js diff --git a/test/models/blockchain.Insight.js b/test/blockchain.Insight.js similarity index 100% rename from test/models/blockchain.Insight.js rename to test/blockchain.Insight.js diff --git a/test/mocha.opts b/test/mocha.opts index f009d3996..cf9aa2649 100644 --- a/test/mocha.opts +++ b/test/mocha.opts @@ -1 +1 @@ ---require test/mocha_node_setup.js --reporter spec test/models/*.js +--require setup/node.js --reporter spec diff --git a/test/mocha_node_setup.js b/test/mocha_node_setup.js deleted file mode 100644 index 0bac889af..000000000 --- a/test/mocha_node_setup.js +++ /dev/null @@ -1,27 +0,0 @@ -if (!!global) { - global.chai = require('chai'); - global.sinon = require('sinon'); - global.bitcore = require('bitcore'); - global.expect = global.chai.expect; - global.bignum = global.bitcore.Bignum; - global.should = global.chai.should(); - - try { - global.copay = require('copay'); - global.copayConfig = require('config'); - } catch (e) { - global.copay = require('../copay'); - global.copayConfig = require('../config'); - } - - global.requireMock = function(name) { - try { - return require('../mocks/' + name); - } catch (e) { - return require('./mocks/' + name); - } - } - - global.is_browser = typeof process == 'undefined' || typeof process.versions === 'undefined'; - global._ = require('underscore'); -} diff --git a/test/models/network.Async.js b/test/network.Async.js similarity index 100% rename from test/models/network.Async.js rename to test/network.Async.js diff --git a/test/models/performance.js b/test/performance.js similarity index 100% rename from test/models/performance.js rename to test/performance.js