propose server tests
This commit is contained in:
parent
2ae7033866
commit
4d1cb07a79
|
@ -617,7 +617,7 @@ WalletService.prototype.removePendingTx = function(opts, cb) {
|
|||
if (err) return cb(err);
|
||||
|
||||
if (!txp.isPending())
|
||||
return cb(new ClientError('Transaction proposal not pending'));
|
||||
return cb(new ClientError('TXNOTPENDING', 'Transaction proposal not pending'));
|
||||
|
||||
|
||||
if (txp.creatorId !== self.copayerId)
|
||||
|
@ -626,7 +626,7 @@ WalletService.prototype.removePendingTx = function(opts, cb) {
|
|||
var actors = txp.getActors();
|
||||
|
||||
if (actors.length > 1 || (actors.length == 1 && actors[0] !== self.copayerId))
|
||||
return cb(new ClientError('Cannot remove a proposal signed/rejected by other copayers'));
|
||||
return cb(new ClientError('TXACTIONED', 'Cannot remove a proposal signed/rejected by other copayers'));
|
||||
|
||||
self._notify('transactionProposalRemoved');
|
||||
self.storage.removeTx(self.walletId, txp.id, cb);
|
||||
|
@ -673,7 +673,7 @@ WalletService.prototype.signTx = function(opts, cb) {
|
|||
});
|
||||
if (action)
|
||||
return cb(new ClientError('CVOTED', 'Copayer already voted on this transaction proposal'));
|
||||
if (txp.status != 'pending')
|
||||
if (!txp.isPending())
|
||||
return cb(new ClientError('TXNOTPENDING', 'The transaction proposal is not pending'));
|
||||
|
||||
var copayer = wallet.getCopayer(self.copayerId);
|
||||
|
|
|
@ -345,6 +345,8 @@ describe('Copay server', function() {
|
|||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it.skip('should fail to create wallet with invalid pubKey argument', function(done) {});
|
||||
});
|
||||
|
||||
describe('#joinWallet', function() {
|
||||
|
@ -451,6 +453,8 @@ describe('Copay server', function() {
|
|||
});
|
||||
});
|
||||
|
||||
it.skip('should fail two wallets with same xPubKey', function(done) {});
|
||||
|
||||
it('should fail to join with bad formated signature', function(done) {
|
||||
var copayerOpts = {
|
||||
walletId: walletId,
|
||||
|
@ -758,6 +762,8 @@ describe('Copay server', function() {
|
|||
});
|
||||
});
|
||||
|
||||
it.skip('should fail to create tx for invalid amount', function(done) {});
|
||||
|
||||
it('should fail to create tx when insufficient funds', function(done) {
|
||||
helpers.stubUtxos(server, wallet, [100], function() {
|
||||
var txOpts = helpers.createProposalOpts('18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', 120, null, TestData.copayers[0].privKey);
|
||||
|
@ -803,6 +809,8 @@ describe('Copay server', function() {
|
|||
});
|
||||
});
|
||||
|
||||
it.skip('should fail gracefully when bitcore throws exception on raw tx creation', function(done) {});
|
||||
|
||||
it('should create tx when there is a pending tx and enough UTXOs', function(done) {
|
||||
helpers.stubUtxos(server, wallet, [10.1, 10.2, 10.3], function() {
|
||||
var txOpts = helpers.createProposalOpts('18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', 12, null, TestData.copayers[0].privKey);
|
||||
|
@ -930,6 +938,8 @@ describe('Copay server', function() {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
it.skip('should fail to reject non-pending TX', function(done) {});
|
||||
});
|
||||
|
||||
describe('#signTx', function() {
|
||||
|
@ -1087,6 +1097,17 @@ describe('Copay server', function() {
|
|||
});
|
||||
});
|
||||
|
||||
describe.skip('#broadcastTx', function() {
|
||||
it.skip('should keep tx as accepted if unable to broadcast it', function(done) {});
|
||||
it.skip('should brodcast a tx', function(done) {
|
||||
// TODO: check final status == 'broadcasted' & broadcastedOn
|
||||
});
|
||||
it.skip('should fail to brodcast an already broadcasted tx', function(done) {});
|
||||
it.skip('should brodcast a not yet accepted tx', function(done) {});
|
||||
it.skip('should brodcast a tx', function(done) {});
|
||||
});
|
||||
|
||||
|
||||
describe('Tx proposal workflow', function() {
|
||||
var server, wallet;
|
||||
beforeEach(function(done) {
|
||||
|
@ -1638,6 +1659,8 @@ describe('Copay server', function() {
|
|||
});
|
||||
});
|
||||
|
||||
it.skip('should fail to remove non-pending TX', function(done) {});
|
||||
|
||||
it('should not allow non-creator copayer to remove an unsigned TX ', function(done) {
|
||||
helpers.getAuthServer(wallet.copayers[1].id, function(server2) {
|
||||
server2.removePendingTx({
|
||||
|
@ -1663,6 +1686,7 @@ describe('Copay server', function() {
|
|||
server.removePendingTx({
|
||||
txProposalId: txp.id
|
||||
}, function(err) {
|
||||
err.code.should.equal('TXACTIONED');
|
||||
err.message.should.contain('other copayers');
|
||||
done();
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue