Tests: Enable tests for network, include defaultNetwork, check each constant, build browser tests before running to make sure it's up-to-date
This commit is contained in:
parent
4adf1fcb14
commit
6e36baebc6
@ -110,7 +110,7 @@ gulp.task('browser-all', ['errors'], function(callback) {
|
||||
runSequence(['browser'], ['browser-test'], callback);
|
||||
});
|
||||
|
||||
gulp.task('karma', testKarma);
|
||||
gulp.task('karma', ['browser-test'], testKarma);
|
||||
|
||||
gulp.task('errors', shell.task([
|
||||
'node ./lib/errors/build.js'
|
||||
|
||||
@ -69,6 +69,5 @@ module.exports = {
|
||||
defaultNetwork: livenet,
|
||||
livenet: livenet,
|
||||
testnet: testnet,
|
||||
mainnet: livenet,
|
||||
get: getNetwork
|
||||
};
|
||||
|
||||
@ -2,24 +2,23 @@
|
||||
|
||||
var should = require('chai').should();
|
||||
var bitcore = require('..');
|
||||
var Networks = bitcore.Networks;
|
||||
var networks = bitcore.Networks;
|
||||
|
||||
describe('Networks', function() {
|
||||
|
||||
it('should contain all Networks', function() {
|
||||
should.exist(Networks.livenet);
|
||||
should.exist(Networks.testnet);
|
||||
should.exist(Networks.mainnet);
|
||||
should.exist(networks.livenet);
|
||||
should.exist(networks.testnet);
|
||||
should.exist(networks.defaultNetwork);
|
||||
});
|
||||
describe('contain all constants for livenet and testnet', function() {
|
||||
var makeTest = function(key) {
|
||||
Networks.testnet.hasOwnProperty(key).should.equal(true);
|
||||
};
|
||||
for (var key in Networks.livenet) {
|
||||
if (Networks.livenet.hasOwnProperty(key)) {
|
||||
it('all should contain ' + key, makeTest(key));
|
||||
}
|
||||
}
|
||||
|
||||
var constants = ['name', 'alias', 'pubkeyhash', 'scripthash', 'xpubkey', 'xprivkey'];
|
||||
|
||||
constants.forEach(function(key){
|
||||
it('should have constant '+key+' for livenet and testnet', function(){
|
||||
networks.testnet.hasOwnProperty(key).should.equal(true);
|
||||
networks.livenet.hasOwnProperty(key).should.equal(true);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user