add tests

This commit is contained in:
Ivan Socolsky 2015-02-08 13:16:41 -03:00
parent 516926c78a
commit c1a0ec6f5d
2 changed files with 26 additions and 4 deletions

View File

@ -91,6 +91,7 @@ CopayServer.prototype.createWallet = function(opts, cb) {
Utils.checkRequired(opts, ['name', 'm', 'n', 'pubKey']);
if (_.isEmpty(opts.name)) return cb(new ClientError('Invalid wallet name'));
if (!Wallet.verifyCopayerLimits(opts.m, opts.n))
return cb(new ClientError('Invalid combination of required copayers / total copayers'));

View File

@ -253,6 +253,21 @@ describe('Copay server', function() {
});
});
it('should fail to create wallet with no name', function(done) {
var opts = {
name: '',
m: 2,
n: 3,
pubKey: aPubKey,
};
server.createWallet(opts, function(err, walletId) {
should.not.exist(walletId);
err.should.exist;
err.message.should.contain('name');
done();
});
});
it('should fail to create wallet with invalid copayer pairs', function(done) {
var invalidPairs = [{
m: 0,
@ -753,6 +768,8 @@ describe('Copay server', function() {
});
});
it.skip('should fail to create tx for address of different network', function(done) {});
it('should fail to create tx when insufficient funds', function(done) {
helpers.createUtxos(server, wallet, helpers.toSatoshi([100]), function(utxos) {
helpers.stubBlockExplorer(server, utxos);
@ -781,6 +798,10 @@ describe('Copay server', function() {
});
});
it.skip('should fail to create tx when insufficient funds for fee', function(done) {});
it.skip('should fail to create tx for dust amount', function(done) {});
it('should create tx when there is a pending tx and enough UTXOs', function(done) {
helpers.createUtxos(server, wallet, helpers.toSatoshi([10.1, 10.2, 10.3]), function(utxos) {
helpers.stubBlockExplorer(server, utxos);
@ -858,7 +879,6 @@ describe('Copay server', function() {
});
});
});
});
});
@ -940,7 +960,6 @@ describe('Copay server', function() {
});
});
});
});
@ -1031,7 +1050,7 @@ describe('Copay server', function() {
});
});
describe('Multisignature wallet', function() {
describe('Tx proposal workflow', function() {
var server, wallet, utxos;
beforeEach(function(done) {
helpers.createAndJoinWallet(2, 3, function(s, w) {
@ -1071,7 +1090,9 @@ describe('Copay server', function() {
});
});
it.skip('tx proposals should not be broadcast until quorum is reached', function(done) {});
it.skip('tx proposals should not be broadcast until quorum is reached', function(done) {
});
it.skip('tx proposals should accept as many rejections as possible without finally rejecting', function(done) {});